[% href = base_url;
IF url_for_paging;
href = href _ '?' _ url_for_paging;
END;
IF page;
p = page;
IF p > n_pages;
p = n_pages;
END;
ELSE;
p = 1; # set the current page number to 1
END;
# show a range of 8 pages around the current page
# s is the start page, e is the end page
s = p - 8;
IF s < 1;
s = 1;
END;
e = p + 8;
IF e > n_pages;
e = n_pages;
END;
i = s;
IF s > 1;
# include a ref to the first page %]
- 1
[% IF s > 2 %]
- ...
[% END;
END;
WHILE i <= e;
IF i == p %]
- [% i %]
[% ELSE %]
- [% i %]
[% END;
i = i + 1;
END;
IF e < n_pages;
# include a ref to the last page
last = n_pages;
IF e + 1 < n_pages %]
- ...
[% END %]
- [% last %]
[% END;
UNLESS disable_view_all_results_link %]
- View all results
[% END %]