From 3a1c8c2b463b8a4f6b3b2c866c5e1b1500f95193 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 25 Dec 2009 14:31:51 -0500 Subject: pagestats: Add show parameter. Closes: #562129 --- IkiWiki/Plugin/pagestats.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm index 47638210a..4313aa271 100644 --- a/IkiWiki/Plugin/pagestats.pm +++ b/IkiWiki/Plugin/pagestats.pm @@ -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 "\n". join("\n", map { -- cgit v1.2.3