From d53f41692d63e9ff361ae8b9508061a9ab4b6edc Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Fri, 5 Dec 2014 23:34:36 +0100 Subject: [PATCH] zendframework/zf2#6808 zendframework/zf2#6809 - avoid multiple internal calls to methods when values are already cached in `$pages` --- src/Paginator.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Paginator.php b/src/Paginator.php index d738e7a..d3c04a8 100644 --- a/src/Paginator.php +++ b/src/Paginator.php @@ -916,10 +916,13 @@ protected function _createPages($scrollingStyle = null) // Item numbers if ($this->getCurrentItems() !== null) { $pages->currentItemCount = $this->getCurrentItemCount(); - $pages->itemCountPerPage = $this->getItemCountPerPage(); $pages->totalItemCount = $this->getTotalItemCount(); - $pages->firstItemNumber = $this->getTotalItemCount() ? (($currentPageNumber - 1) * $this->getItemCountPerPage()) + 1 : 0; - $pages->lastItemNumber = $this->getTotalItemCount() ? $pages->firstItemNumber + $pages->currentItemCount - 1 : 0; + $pages->firstItemNumber = $pages->totalItemCount + ? (($currentPageNumber - 1) * $pages->itemCountPerPage) + 1 + : 0; + $pages->lastItemNumber = $pages->totalItemCount + ? $pages->firstItemNumber + $pages->currentItemCount - 1 + : 0; } return $pages;