+ unlockwiki();
+
+ # 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};
+ error($@) if $@;
+ memoize("htmllink");
+
+ eval q{use Time::Duration};
+ error($@) if $@;
+ eval q{use CGI 'escapeHTML'};
+ error($@) if $@;
+
+ my $changelog=[rcs_recentchanges(100)];
+ foreach my $change (@$changelog) {
+ $change->{when} = concise(ago($change->{when}));
+
+ if ($change->{user} =~ m!^https?://! &&
+ eval q{use Net::OpenID::VerifiedIdentity; 1} && !$@) {
+ # Munge user-urls, as used by eg, OpenID.
+ my $oid=Net::OpenID::VerifiedIdentity->new(identity => $change->{user});
+ $change->{user} = "<a href=\"".$change->{user}."\">".escapeHTML($oid->display)."</a>";
+ }
+ else {
+ $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");