Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (35 sloc) 1.3 KB
[% IF pager AND pager.entries_per_page AND pager.last_page > 1 %]
[% base_url = base_url.replace('/p.(\d+)/', '/').replace('/p.(\d+)$', '').replace('/$', '');
IF base_url.search('.html');
pmatches = base_url.match('^(.*)/([^\/]+)$');
ELSE;
pmatches = [base_url, ''];
END;
%]
<div class="pull-right">
<ul class="pagination">
[% IF pager.previous_page %]
<li><a href="[% pmatches.0 %]/[% pmatches.1 %]">First</a></li>
<li><a href="[% pmatches.0 %]/p.[% pager.previous_page %]/[% pmatches.1 %]">Prev</a></li>
[% END %]
[% IF pager.current_page - 4 > 0 %]
[% start_page = pager.current_page - 4 %]
[% ELSE %]
[% start_page = 1 %]
[% END %]
[% IF pager.last_page > pager.current_page + 4 %]
[% end_page = pager.current_page + 4 %]
[% ELSE %]
[% end_page = pager.last_page %]
[% END %]
[% FOREACH page = [ start_page .. end_page ] %]
<li[% IF page == pager.current_page %] class="active"[% END %]>
<a href='[% pmatches.0 %]/p.[% page %]/[% pmatches.1 %]'>[% page %]</a>
[% END %]
[% IF pager.next_page %]
<li><a href="[% pmatches.0 %]/p.[% pager.next_page %]/[% pmatches.1 %]">Next</a></li>
<li><a href="[% pmatches.0 %]/p.[% pager.last_page %]/[% pmatches.1 %]">Last</a></li>
[% END %]
</ul>
</div>
[% END %]