summaryrefslogtreecommitdiff
path: root/index.pl
diff options
context:
space:
mode:
Diffstat (limited to 'index.pl')
-rw-r--r--index.pl17
1 files changed, 10 insertions, 7 deletions
diff --git a/index.pl b/index.pl
index 6a7805f..9ae057d 100644
--- a/index.pl
+++ b/index.pl
@@ -512,13 +512,16 @@ get '/top' => sub {
}
my @argsort = reverse sort { $rates[$a] <=> $rates[$b] } ( 1 .. 99 );
- my @toplist = map {
- [
- $translation{$_} // $_,
- sprintf( '%.2f%%', $rates[$_] * 100 / $total ),
- $rates[$_]
- ]
- } @argsort;
+ my @toplist;
+ if ( $total > 0 ) {
+ @toplist = map {
+ [
+ $translation{$_} // $_,
+ sprintf( '%.2f%%', $rates[$_] * 100 / $total ),
+ $rates[$_]
+ ]
+ } @argsort;
+ }
$self->render(
'toplist',