]> iEval git - gruntmaster-page.git/commitdiff
fixed "Page 1 of 0" in job log newmc
authorSergiu Puscas <srg.pscs@gmail.com>
Sun, 9 Apr 2017 21:39:39 +0000 (00:39 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Tue, 11 Apr 2017 13:44:36 +0000 (16:44 +0300)
lib/Plack/App/Gruntmaster/HTML.pm

index 427b197002a5fff16c0dc299f85fde0e88003c95..b4abd19f5194fbe28f40bcd41e9794b237119f8b 100644 (file)
@@ -4,6 +4,7 @@ use parent qw/Exporter/;
 our @EXPORT = qw/render render_article/;
 
 use File::Slurp qw/read_file/;
 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//;
 use HTML::Element::Library;
 use HTML::TreeBuilder;
 use POSIX qw//;
@@ -277,7 +278,9 @@ sub process_log {
                my $str = join '&', map { $_ . '=' . $args{args}{$_} } keys %{$args{args}};
                $elem->find('a')->edit_href(sub{s/$/&$str/}) if $str;
        }
                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 {
 }
 
 sub process_st {
This page took 0.025669 seconds and 4 git commands to generate.