From c09481c519ec5c208907d9fb506f4926312cbde9 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 22 Jul 2011 09:49:13 -0700 Subject: [PATCH] Refactoring the Paginator class. --- system/paginator.php | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/system/paginator.php b/system/paginator.php index 1507c348..e91ff63d 100644 --- a/system/paginator.php +++ b/system/paginator.php @@ -72,11 +72,7 @@ public function __construct($results, $total, $per_page) */ public static function page($total, $per_page) { - $last_page = ceil($total / $per_page); - - $page = Input::get('page', 1); - - if (is_numeric($page) and $page > $last_page) + if (is_numeric($page = Input::get('page', 1)) and $page > $last_page = ceil($total / $per_page)) { return $last_page; } @@ -92,12 +88,7 @@ public static function page($total, $per_page) */ public function links($adjacent = 3) { - if ($this->last_page() > 1) - { - return '