% my $make_link_num = begin % my ($txt, $to) = @_; %= link_to $txt => url_with->query({start => $to}) => (class => (param('start')//0) == $to ? 'pagination-link is-current' : 'pagination-link') % end % my $nbh = begin % my $num = $pgn->{total_pages} > 5 ? 5 : $pgn->{total_pages}; % my $start = $pgn->{current_page}-2 < 0 ? 0 : $pgn->{current_page}-2; % if ($start+$num > $pgn->{total_pages}) { $start = $pgn->{total_pages}-$num } % for ($start..$start+$num-1) {
  • %= $make_link_num->($_+1 => $_*$pgn->{page_size})
  • % } % end