snip_pagination - UltraTrains

#set($pageCount = $group.getPageCount(12))
#if ($pageCount > 1)
  <ul>
    #set($minPage = $page - 5)
    #if ($minPage < 1)
       #set($minPage = 1)
    #end
  
    #set($maxPage = $page + 5)
    #if ($maxPage > $pageCount)
       #set($maxPage = $pageCount)
    #end
  
    #if ($minPage > 1 && $maxPage < 10)
       #set ($minPage = 1)
    #end
  
    #if ($pageCount - $minPage < 10)
       #set ($maxPage = $pageCount)
    #end
  
    #if ($page == 1)
    <li>
      <span>&laquo; Previous Page</span>
    </li>
    #else
      #set($pageNumber = $page - 1)
      <li>
        <a href="$baseUrl${group.Path}index-${pageNumber}.html" class="next_previous">&laquo; Previous Page</a>
      </li>
    #end
  
    #foreach( $pageIndex in [$minPage..$maxPage] )
      #if ($pageIndex == $page)
        <li>
          <strong>$pageIndex</strong>
        </li>
      #else
        <li>
          <a href="$baseUrl${group.Path}index-${pageIndex}.html">$pageIndex</a>
        </li>
      #end
    #end
  
    #if ($pageCount == $page)
      <li>
        <span>Next Page &raquo;</span>
      </li>
    #else
      #set($pageNumber = $page + 1)
      <li>
        <a href="$baseUrl${group.Path}index-${pageNumber}.html" class="next_previous">Next Page &raquo;</a>
      </li>
    #end
  </ul>
#end