[% # paging, weeee page = CGI.param('page'); page = page.match('^\d+$') ? page : 0; # verify page is a sane value page_count = ctx.page_size == 0 ? 1 : POSIX.ceil(ctx.hit_count / ctx.page_size); ctx.result_start = 1 + ctx.page_size * page; ctx.result_stop = ctx.page_size * (page + 1); IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END; result_count = ctx.result_start; %]