Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #2541. You can now manually set the current page number.

  • Loading branch information...
commit 88d3b44cc473c7d4f073c93269da65836d14da6c 1 parent 99f0669
Geert De Deckere authored
Showing with 18 additions and 10 deletions.
  1. +18 −10 classes/kohana/pagination.php
View
28 classes/kohana/pagination.php
@@ -136,17 +136,25 @@ public function setup(array $config = array())
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
Please sign in to comment.
Something went wrong with that request. Please try again.