diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2009-12-25 14:31:51 -0500 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-12-25 14:31:51 -0500 |
commit | 3a1c8c2b463b8a4f6b3b2c866c5e1b1500f95193 (patch) | |
tree | 2f517365da1620c6af25e76335036b9dfb35c78c /IkiWiki | |
parent | dbf0f25346a7eb0b63581639df3ac0c73753a0f0 (diff) | |
download | ikiwiki-3a1c8c2b463b8a4f6b3b2c866c5e1b1500f95193.tar ikiwiki-3a1c8c2b463b8a4f6b3b2c866c5e1b1500f95193.tar.gz |
pagestats: Add show parameter. Closes: #562129
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/pagestats.pm | 10 |
1 files changed, 10 insertions, 0 deletions
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 "<table class='pageStats'>\n". join("\n", map { |