title: Creating a Pagination class in PHP
body: <p>I want to build a <code>paginator</code> class, but i'm not sure what the best method is. I see many different codes on the internet that confuses me.</p>
  
  <p>My data is stored in a MySQL database. Do i have to give a query to my pagniator class so that it can retrieve the data out of MySQL for me (and of course it will automatically do some pagination calculations after that)? Or do i get all the data from a <code>model</code> first, then supply the returned <code>array</code> from that model to the <code>paginator</code> class? </p>
  
  <p>In either way i'd probably have to do another query to get the "total" amount of records and pass that result to the <code>pagninator</code> class as a separate param.</p>
  
  <p>Once i know how to get started then i know how to pick up the rest. I'm just not sure how to pass in the data to the <code>paginator</code> class and what kind of data. </p>
  
  <p>Any idea how to build a good <code>paginator</code> class?</p>