+ # Optimisation: building recentchanges means calculating lots of
+ # links. Memoizing htmllink speeds it up a lot (can't be memoized
+ # during page builds as the return values may change, but they
+ # won't here.)
+ eval q{use Memoize};
+ memoize("htmllink");
+
+ eval q{use Time::Duration};
+ eval q{use CGI 'escapeHTML'};
+
+ my $changelog=[rcs_recentchanges(100)];
+ foreach my $change (@$changelog) {
+ $change->{when} = concise(ago($change->{when}));
+ $change->{user} = htmllink("", "", escapeHTML($change->{user}), 1);
+
+ my $is_excess = exists $change->{pages}[10]; # limit pages to first 10
+ delete @{$change->{pages}}[10 .. @{$change->{pages}}] if $is_excess;
+ $change->{pages} = [
+ map {
+ $_->{link} = htmllink("", "", $_->{page}, 1);
+ $_;
+ } @{$change->{pages}}
+ ];
+ push @{$change->{pages}}, { link => '...' } if $is_excess;
+ }
+
+ my $template=template("recentchanges.tmpl");