]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/pagestats.pm
brace style and layout
[ikiwiki.git] / IkiWiki / Plugin / pagestats.pm
index 47638210aeddeff49866ac1e5a6459828556ddd2..4313aa271e2f55259b04df7b7abfbd1a447ba1cb 100644 (file)
@@ -63,6 +63,16 @@ sub preprocess (@) {
                $max = $counts{$page} if $counts{$page} > $max;
        }
 
+       if (exists $params{show}) {
+               my $i=0;
+               my %show;
+               foreach my $key (sort { $counts{$b} <=> $counts{$a} } keys %counts) {
+                       last if ++$i > $params{show};
+                       $show{$key}=$counts{$key};
+               }
+               %counts=%show;
+       }
+
        if ($style eq 'table') {
                return "<table class='pageStats'>\n".
                        join("\n", map {