From 11ffed7cfc9d9047caf3fc317e69b9b970e543f4 Mon Sep 17 00:00:00 2001 From: vrana Date: Fri, 27 Apr 2012 15:54:34 -0700 Subject: [PATCH] Fix paging for 'before ID' queries Test Plan: https://secure.phabricator.com/paste/filter/all/?before=157 - 158 is missing. Reviewers: epriestley Reviewed By: epriestley CC: aran, Koolvin Differential Revision: https://secure.phabricator.com/D2330 --- src/view/control/idpager/AphrontIDPagerView.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/view/control/idpager/AphrontIDPagerView.php b/src/view/control/idpager/AphrontIDPagerView.php index 3f455caa07..4f7486d59b 100644 --- a/src/view/control/idpager/AphrontIDPagerView.php +++ b/src/view/control/idpager/AphrontIDPagerView.php @@ -87,7 +87,8 @@ final class AphrontIDPagerView extends AphrontView { final public function sliceResults(array $results) { if (count($results) > $this->getPageSize()) { - $results = array_slice($results, 0, $this->getPageSize(), true); + $offset = ($this->beforeID ? count($results) - $this->getPageSize() : 0); + $results = array_slice($results, $offset, $this->getPageSize(), true); } return $results; }