Show
Ignore:
Timestamp:
08/26/2007 03:36:11 PM (16 months ago)
Author:
Geert
Message:

Some bug fixes after first testing round

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/devel/system/libraries/Pagination.php

    r407 r413  
    6363                $this->total_pages        = (int) ceil($this->total_items / $this->items_per_page); 
    6464                $this->current_page       = (int) min(max(1, Kohana::instance()->uri->segment($this->uri_segment)), max(1, $this->total_pages)); 
    65                 $this->current_first_item = (int) (($this->current_page - 1) * $this->items_per_page) + 1; 
     65                $this->current_first_item = (int) min((($this->current_page - 1) * $this->items_per_page) + 1, $this->total_items); 
    6666                $this->current_last_item  = (int) min($this->current_first_item + $this->items_per_page - 1, $this->total_items); 
    6767                 
     
    7070                // - previous_page/next_page  FALSE if that page doesn't exist relative to the current page 
    7171                $this->first_page         = ($this->current_page == 1) ? FALSE : 1; 
    72                 $this->last_page          = ($this->current_page == $this->total_pages) ? FALSE : $this->total_pages; 
     72                $this->last_page          = ($this->current_page >= $this->total_pages) ? FALSE : $this->total_pages; 
    7373                $this->previous_page      = ($this->current_page > 1) ? $this->current_page - 1 : FALSE; 
    7474                $this->next_page          = ($this->current_page < $this->total_pages) ? $this->current_page + 1 : FALSE; 
     
    8787        public function create_links($style = NULL) 
    8888        { 
    89                 $style = (isset($style)) ? $this->style : $style; 
     89                $style = (isset($style)) ? $style : $this->style; 
    9090                 
    9191                return (string) new View('views/pagination/'.$style, get_object_vars($this));