my ($self, $htc, $path, $lang) = @_;
$path =~ m,^(?:ct/([^/]+)/)?log/(\w+)\.html$,;
- local $Gruntmaster::Data::contest = $1;
- my $pages = jobcard / PAGE_SIZE;
+ local $Gruntmaster::Data::contest = $1 if $1;
+ my $pages = POSIX::ceil (jobcard / PAGE_SIZE);
my $page = $2 eq 'index' ? $pages : $2;
my @log = sort { $b->{id} <=> $a->{id} } map +{
result => job_result,
result_text => job_result_text,
size => sprintf ("%.2f KiB", job_filesize() / 1024),
- user => job_user}, ($page - 1) * PAGE_SIZE + 1 .. $page == $pages ? jobcard : $page * PAGE_SIZE;
+ user => job_user}, ($page - 1) * PAGE_SIZE + 1 .. ($page == $pages ? jobcard : $page * PAGE_SIZE);
$htc->param(log => \@log);
}