<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<div xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      py:strip="True">

<span py:match="span[@class='commaise']">
   <span py:replace="tg.commaise(select('*'))" />
</span>

<div py:match="div[@class='pagination']" class="pagination">
<p>Page ${tg.paginate.current_page} of ${tg.paginate.page_count}</p>
<span py:for="page in [1,2,3]">
    <a py:if="page not in tg.paginate.pages and tg.paginate.page_count > page" href="${tg.paginate.get_href(page)}">${page}</a>
</span>
<span py:if="tg.paginate.page_count > 6 and tg.paginate.current_page > 6">
    ...
</span>
<span py:for="page in tg.paginate.pages">
    <a py:if="page != tg.paginate.current_page"
        href="${tg.paginate.get_href(page)}">${page}</a>
    <b py:if="page == tg.paginate.current_page">${page}</b>
</span>
<span py:if="tg.paginate.page_count - 3 not in tg.paginate.pages and
tg.paginate.page_count > 3">
    ...
</span>
<span py:if="page > 0" py:for="page in [tg.paginate.page_count - 2,
tg.paginate.page_count - 1, tg.paginate.page_count]">
    <a py:if="page not in tg.paginate.pages"
href="${tg.paginate.get_href(page)}">${page}</a>
</span>
</div>

</div>
