our @EXPORT = qw/render render_article/;
use File::Slurp qw/read_file/;
+use List::Util qw[min max];
use HTML::Element::Library;
use HTML::TreeBuilder;
use POSIX qw//;
my $str = join '&', map { $_ . '=' . $args{args}{$_} } keys %{$args{args}};
$elem->find('a')->edit_href(sub{s/$/&$str/}) if $str;
}
- $tree->fclass('current')->replace_content("Page $args{current_page} of $args{last_page}");
+
+ my $total_pages = max(1, $args{last_page});
+ $tree->fclass('current')->replace_content("Page $args{current_page} of $total_pages");
}
sub process_st {