<!-- BEGIN cgi_pager.tt -->
  [% SET pager = cgi_pager %] [% # PROCESS dumper.tt dump = pager %]

[% IF pager AND pager.total_count > c.cfg('settings').entries_per_page %]
	<p class="pager">Pages:
		[% FOREACH page IN pager.pages %][% # PROCESS dumper.tt dump = page %]
			[% IF page.is_current # highlight it %]
				<span class="current_page">[% page.number %]</span>
			[% ELSE # generate url %]
				<a href="[% page.url | html%]">[% page.number %]</a>
			[% END %]
		[% END %]
	</p>

	<p class="indent">
        [% IF pager.prev_url # link backwards %]
			<a href="[% pager.prev_url | html %]">&laquo; prev</a>
        [% ELSE %]
            &laquo; prev
		[% END %]
        ::
		[% IF pager.next_url # link forwards %]
			 <a href="[% pager.next_url | html %]">next &raquo;</a>
        [% ELSE %]
            next &raquo;
		[% END %]
    </p>

    [% # form method needs to be 'get' for pager to use value in urls: %]
    <form method="get" action="[% c.query.url(path_info=1) %]">
        <p class="indent">Change no. of entries per page:
            <select name="entries_per_page" onchange="submit()">
            [% SET entries_per_page_selected = c.query.param('entries_per_page')
                || c.cfg('settings').entries_per_page || 10 %]

            [% FOREACH val IN [ 10, 20, 50, 100 ] %]
                <option [% 'selected' IF val == entries_per_page_selected %]>[% val %]</option>
                [% LAST IF val > pager.total_count # so will display all on page %]
            [% END %]
            </select>

            [% FOREACH param IN c.query.param -%]
                [% NEXT IF param.match('entries_per_page') || param.match('offset') # to start at first record -%]
            <input type="hidden" name="[% param %]" value="[% c.query.param(param) %]" />
            [% END %]
        </p>
    </form>
[% END %]

[% IF negate_this_to_display %]
<pre>
    <u>CGI::Pager methods:</u>
	first_url = [% pager.first_url %]
	
	prev_url  = [% pager.prev_url %]
	
	next_url  = [% pager.next_url %]
	
	last_url  = [% pager.last_url %]

	is_at_start    = [% pager.is_at_start %]

	is_at_end      = [% pager.is_at_end %]
	
	next_offset    = [% pager.next_offset %]

	prev_offset    = [% pager.prev_offset %]

	last_offset    = [% pager.last_offset %]
	
	first_pos_displayed = [% pager.first_pos_displayed %]
	
	last_pos_displayed  = [% pager.last_pos_displayed %]
	
	html(combined) = [% pager.html('combined') %]
	
	html(pages)    = [% pager.html('pages') %]
	
	total_count    = [% pager.total_count %]

    <u>Others:</u>
	app_url        = [% app_url %]
	
	url_with_path  = [% url_with_path %]
	
	params         = [% c.query.param.join(';') %]
</pre>
[% END %]
<!-- END cgi_pager.tt -->