public final function executeWithCursorPager(AphrontCursorPagerView $pager)
 {
     $limit = $pager->getPageSize();
     $this->setLimit($limit + 1);
     if ($pager->getAfterID()) {
         $this->setAfterID($pager->getAfterID());
     } else {
         if ($pager->getBeforeID()) {
             $this->setBeforeID($pager->getBeforeID());
         }
     }
     $results = $this->execute();
     $count = count($results);
     $sliced_results = $pager->sliceResults($results);
     if ($sliced_results) {
         list($before, $after) = $this->getPageCursors($sliced_results);
         if ($pager->getBeforeID() || $count > $limit) {
             $pager->setNextPageID($after);
         }
         if ($pager->getAfterID() || $pager->getBeforeID() && $count > $limit) {
             $pager->setPrevPageID($before);
         }
     }
     return $sliced_results;
 }
 public final function executeWithCursorPager(AphrontCursorPagerView $pager)
 {
     $this->setLimit($pager->getPageSize() + 1);
     if ($pager->getAfterID()) {
         $this->setAfterID($pager->getAfterID());
     } else {
         if ($pager->getBeforeID()) {
             $this->setBeforeID($pager->getBeforeID());
         }
     }
     $results = $this->execute();
     $sliced_results = $pager->sliceResults($results);
     if ($this->beforeID || count($results) > $pager->getPageSize()) {
         $pager->setNextPageID($this->getPagingValue(last($sliced_results)));
     }
     if ($this->afterID || $this->beforeID && count($results) > $pager->getPageSize()) {
         $pager->setPrevPageID($this->getPagingValue(head($sliced_results)));
     }
     return $sliced_results;
 }