CodeIgniter Forums
Pagination variables - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Pagination variables (/thread-10478.html)



Pagination variables - El Forum - 08-01-2008

[eluser]Spiked[/eluser]
I noticed that the Pagination documentation and class itself uses strings to define the total_rows and per_page variables passed to the "Initialize" function, but the library itself converts it to integers. Nothing dangerous, just a bit "dirty".

system/libraries/Pagination.php
Code:
var $total_rows          = ''; // Total number of items (database results)
var $per_page             = 10; // Max number of items you want shown per page

.. snip ..

if ($this->total_rows == 0 OR $this->per_page == 0)

.. snip ..

$num_pages = ceil($this->total_rows / $this->per_page);

.. snip ..

if ($this->cur_page > $this->total_rows)
And more.

http://ellislab.com/codeigniter/user-guide/libraries/pagination.html