php-paginator icon indicating copy to clipboard operation
php-paginator copied to clipboard

alter function ceil per floor in updateNumPages

Open thadeu opened this issue 9 years ago • 1 comments

protected function updateNumPages(){ $this->numPages = ($this->itemsPerPage == 0 ? 0 : (int) floor($this->totalItems/$this->itemsPerPage)); }

thadeu avatar May 10 '16 00:05 thadeu

If you round down wouldn't you need up with orphan items?

Example: lets say we have 25 items with 10 items per page.

if we use floor we would round 2.5 down to 2 pages, leaving 5 items orphaned.

if we use ceil we would round 2.5 up to 3 pages, making sure that the last 5 items are not orphaned.

bhhaskin avatar Mar 07 '17 19:03 bhhaskin