title: Pagination Upper and Lower Limit
body: <p>I'm trying to get the upper and lower limit for my pagination buttons.</p>
  
  <p>I want there to always be 9 buttons. So initially with a current page index of 1 it would be:</p>
  
  <p>| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |</p>
  
  <p>So my lower would be 1 and my upper would be 9.</p>
  
  <p>When the current page index gets to 8 I would want the pagination to look like this:</p>
  
  <p>| 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |</p>
  
  <p>Say the total pages where 15 and the current page index is now 14 the pagination would look like:</p>
  
  <p>| 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |</p>
  
  <p>I cant seem to get it just right. My attempt using LINQ so far is (which is way off what I want it to do):</p>
  
  <pre><code>LowerCount = PageIndex;
  HigherCount = (int)PageIndex + 5 &lt; TotalPages ? PageIndex + 5 : TotalPages;
  </code></pre>