5 * Analyze our ACCESS_LOG
9 include_once("lib/PageList.php");
11 class WikiPlugin_RecentReferrers extends WikiPlugin
14 return _("RecentReferrers");
17 function getDescription () {
18 return _("Analyse access log.");
21 function getVersion() {
22 return preg_replace("/[Revision: $]/", '',
26 function getDefaultArguments() {
29 PageList::supportedArgs(),
36 function run($dbi, $argstr, &$request, $basepage) {
38 return HTML::div(array('class' => "error"), "Error: no ACCESS_LOG");
40 $args = $this->getArgs($argstr, $request);
41 $table = HTML::table(array('cellpadding' => 1,
44 'class' => 'pagelist'));
45 if (!$args['noheader'] and !empty($args['caption']))
46 $table->pushContent(HTML::caption(array('align'=>'top'), $args['caption']));
48 $limit = $args['limit'];
49 $accesslog =& $request->_accesslog;
50 if ($logiter = $accesslog->get_referer($limit, "external_only")
51 and $logiter->count()) {
52 $table->pushContent(HTML::tr(HTML::th("Target"),HTML::th("Referrer"),
53 HTML::th("Host"),HTML::th("Date")));
54 while($logentry = $logiter->next()) {
55 $table->pushContent(HTML::tr(HTML::td($logentry['request']),
56 HTML::td($logentry['referer']),
57 HTML::td($logentry['host']),
58 HTML::td($logentry['time'])
66 // (c-file-style: "gnu")
71 // c-hanging-comment-ender-p: nil
72 // indent-tabs-mode: nil