From 88d3b44cc473c7d4f073c93269da65836d14da6c Mon Sep 17 00:00:00 2001 From: Geert De Deckere Date: Sat, 12 Jun 2010 12:08:12 +0200 Subject: [PATCH] Fixed #2541. You can now manually set the current page number. --- classes/kohana/pagination.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/classes/kohana/pagination.php b/classes/kohana/pagination.php index e6e024e..86a72d8 100644 --- a/classes/kohana/pagination.php +++ b/classes/kohana/pagination.php @@ -136,17 +136,25 @@ class Kohana_Pagination { OR isset($config['items_per_page'])) { // Retrieve the current page number - switch ($this->config['current_page']['source']) + if ( ! empty($this->config['current_page']['page'])) { - case 'query_string': - $this->current_page = isset($_GET[$this->config['current_page']['key']]) - ? (int) $_GET[$this->config['current_page']['key']] - : 1; - break; - - case 'route': - $this->current_page = (int) Request::current()->param($this->config['current_page']['key'], 1); - break; + // The current page number has been set manually + $this->current_page = (int) $this->config['current_page']['page']; + } + else + { + switch ($this->config['current_page']['source']) + { + case 'query_string': + $this->current_page = isset($_GET[$this->config['current_page']['key']]) + ? (int) $_GET[$this->config['current_page']['key']] + : 1; + break; + + case 'route': + $this->current_page = (int) Request::current()->param($this->config['current_page']['key'], 1); + break; + } } // Calculate and clean all pagination variables -- 2.11.4.GIT