summaryrefslogtreecommitdiffstats
path: root/system/libraries/Pagination.php
diff options
context:
space:
mode:
authorRonald Beilsma <beilsma@gmail.com>2012-01-10 15:45:31 +0100
committerRonald Beilsma <beilsma@gmail.com>2012-01-10 15:45:31 +0100
commit25dcb93d05bd098e89188ea0691adf72228bd131 (patch)
tree37d3d769f2e64bebb48a98378c7aee3ab4c17efe /system/libraries/Pagination.php
parentdb66eb38cfc4a2ab6c8816b8f7663211232d4f4e (diff)
parente9a5a862a1252548b463aa738e50e8d9bfd01379 (diff)
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into develop
Diffstat (limited to 'system/libraries/Pagination.php')
-rw-r--r--system/libraries/Pagination.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 63b750bdb..35ac541e8 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
@@ -142,6 +142,12 @@ class CI_Pagination {
// Determine the current page number.
$CI =& get_instance();
+ // See if we are using a prefix or suffix on links
+ if ($this->prefix != '' OR $this->suffix != '')
+ {
+ $this->cur_page = (int) str_replace(array($this->prefix, $this->suffix), '', $CI->uri->segment($this->uri_segment));
+ }
+
if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
{
if ($CI->input->get($this->query_string_segment) != $base_page)
@@ -149,7 +155,7 @@ class CI_Pagination {
$this->cur_page = (int) $CI->input->get($this->query_string_segment);
}
}
- elseif ($CI->uri->segment($this->uri_segment) != $base_page)
+ elseif ( ! $this->cur_page AND $CI->uri->segment($this->uri_segment) != $base_page)
{
$this->cur_page = (int) $CI->uri->segment($this->uri_segment);
}
@@ -160,7 +166,7 @@ class CI_Pagination {
$this->cur_page = $base_page;
}
- $this->num_links = (int)$this->num_links;
+ $this->num_links = (int) $this->num_links;
if ($this->num_links < 1)
{
@@ -222,13 +228,13 @@ class CI_Pagination {
{
$i = ($this->use_page_numbers) ? $uri_page_number - 1 : $uri_page_number - $this->per_page;
- if (($i == 0 OR ($this->use_page_numbers && $i == 1)) AND $this->first_url != '')
+ if ($i == $base_page AND $this->first_url != '')
{
$output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
}
else
{
- $i = ($i == 0) ? '' : $this->prefix.$i.$this->suffix;
+ $i = ($i == $base_page) ? '' : $this->prefix.$i.$this->suffix;
$output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
}