title: ColdFusion paging and page numbers
body: <p>I have a list of user comments stored in a database and I'm displaying 10 per page. On page load I need to dynamically render the appropriate amount of page numbers. At first I thought I would just get the total amount of comments and divide that by 10 to get the # of pages. That however doesn't work correctly. For example:</p>
  
  <pre><code>1. 1-10
  2. 11-21
  3. 22-32
  4. 33-43
  5. 44-54
  6. 55-65
  7. 66-76
  </code></pre>
  
  <p>So basically with my original math if I have 70 results I will have 7 pages, but if I have 71 results I get 8 pages, which obviously isn't correct. How can I fix this?</p>
  
  <p>Here's my original code:</p>
  
  <pre><code>&lt;cfset commentsNumber = getComments.recordcount / 10&gt;
  
  
            &lt;cfloop from="1" to="#commentsNumber#" index="i" &gt;
            &lt;cfoutput&gt;
            #i#
            &lt;/cfoutput&gt;
            &lt;/cfloop&gt;
  </code></pre>
  
  <p><strong>Edit:</strong> I can't do math today :(</p>