2 page = CGI.param('page');
3 page = page.match('^\d+$') ? page : 0; # verify page is a sane value
4 page_count = ctx.page_size == 0 ? 1 : POSIX.ceil(ctx.hit_count / ctx.page_size);
5 ctx.result_start = 1 + ctx.page_size * page;
6 ctx.result_stop = ctx.page_size * (page + 1);
7 IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END;
8 result_count = ctx.result_start;
11 <table cellpadding="0" cellspacing="0" border="0" width="100%">
18 href = mkurl('', {page => page - 1});
19 ELSE; class = class _ ' invisible'; END %]
20 <a class="[% class %]" href="[% href %]"><img src="[% ctx.media_prefix %]/images/kpac/arrow_last.png" /></a>
24 <td width="100%" class="nav_mid_bg">
25 <table cellpadding="0" cellspacing="0" border="0" align="center">
27 [% |l(page + 1, page_count) %]
28 <td>Page </td><td class="current_page">[_1]</td><td> of </td><td class="total_pages">[_2]</td>
35 <td class="to_top_btn">
38 IF (page + 1) < page_count;
39 href = mkurl('', {page => page + 1});
40 ELSE; class = class _ ' invisible'; END;
42 <a class="[% class %]" href="[% href %]"><img src="[% ctx.media_prefix %]/images/kpac/arrow_next.png" /></a>
46 [% IF showtop; href = mmkurl('').replace('#.*', '') %]
47 <td class="to_top_btn"><a href="[% href %]"><img src="[% ctx.media_prefix %]/images/kpac/to_top_btn.png" /></a></td>