[% DEFAULT page = 1, page_count = undef, title = 'Pages', prefix = 'post-list/', suffix = '' -%] [% IF page_count <= 10; from = 1; to = page_count; ELSE; from = page - 10 >= 1 ? page - 10 : 1 to = page + 9 >= page_count ? page_count : page + 9; END -%]
[% title %]: | [%- IF page > 1 %] Previous [%- END %] | [%- i = from; %] [%- WHILE i <= to %] [%- IF i == page %][% i %] | [%- ELSE %][% i %] | [%- END %] [%- i = i + 1 %] [%- END %][%- IF page < page_count %] | [%- END %]