function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->title;
     // get local configuration (default, true, false)
     $use_links = $this->get_config('use_links', 'default');
     // get global configuration (true, false)
     $global_use_link = serendipity_get_config_var('top_as_links', false, true);
     // if local configuration say to use global default, do so
     if ($use_links === 'default') {
         $use_links = serendipity_db_bool($global_use_link);
     } else {
         $use_links = serendipity_db_bool($use_links);
     }
     echo serendipity_displayTopExits($this->get_config('limit', 10), $use_links, $this->get_config('interval', 7));
 }
    function event_hook($event, &$bag, &$eventData, $addData = null)
    {
        global $serendipity;
        $hooks =& $bag->get('event_hooks');
        if (isset($hooks[$event])) {
            switch ($event) {
                case 'frontend_configure':
                    if ($this->get_config('ext_vis_stat') == 'no') {
                        return;
                    }
                    //checking if db tables exists, otherwise install them
                    $tableChecker = serendipity_db_query("SELECT counter_id FROM {$serendipity['dbPrefix']}visitors LIMIT 1", true);
                    if (!is_array($tableChecker)) {
                        $this->createTables();
                    }
                    if ((int) $this->get_config('db_indices_created', '0') == 0) {
                        $this->updateTables();
                    }
                    if ((int) $this->get_config('db_indices_created', '1') == 1) {
                        $this->updateTables(1);
                    }
                    //Unique visitors are beeing registered and counted here. Calling function below.
                    $sessionChecker = serendipity_db_query("SELECT count(sessID) FROM {$serendipity['dbPrefix']}visitors WHERE '" . serendipity_db_escape_string(session_id()) . "' = sessID GROUP BY sessID", true);
                    if (!is_array($sessionChecker) || is_array($sessionChecker) && $sessionChecker[0] == 0) {
                        $referer = $useragent = $remoteaddr = 'unknown';
                        // gathering intel
                        if ($_SERVER['REMOTE_ADDR']) {
                            $remoteaddr = $_SERVER['REMOTE_ADDR'];
                        }
                        if ($_SERVER['HTTP_USER_AGENT']) {
                            $useragent = substr($_SERVER['HTTP_USER_AGENT'], 0, 255);
                        }
                        if ($_SERVER['HTTP_REFERER']) {
                            $referer = substr($_SERVER['HTTP_REFERER'], 0, 255);
                        }
                        $found = 0;
                        // avoiding banned browsers
                        if ($this->get_config('banned_bots') == 'yes') {
                            // excludelist botagents
                            $banned_array = array('1' => "unknown", '2' => "bot", '3' => "slurpy", '4' => "agent 007", '5' => "ichiro", '6' => "ia_archiver", '7' => "zyborg", '8' => "linkwalker", '9' => "crawler", '10' => "python", '11' => "w3c_validator", '12' => "almaden", '13' => "topicspy", '14' => "poodle predictor", '15' => "link checker pro", '16' => "xenu link sleuth", '17' => "iconsurf", '18' => "zoe indexer", '19' => "grub-client", '20' => "spider", '21' => "pompos", '22' => "virus_detector", '23' => "bot", '24' => "Wells Search II", '25' => "Dumbot", '26' => "GeoBot", '27' => "DigExt", '28' => "Jeeves/Teoma", '29' => "FeedBurner", '30' => "Technorati", '31' => "Java/1.5.0_10", '32' => "Java/1.5.0_06", '33' => "MarsEdit", '34' => "Blogslive", '35' => "XMLRPCCocoa", '36' => "Google", '37' => "MagpieRSS", '38' => "Sphere Scout", '39' => "BlogCorpusReader", '41' => "libwww-perl", '42' => "WordPress", '43' => "ping.wordblog.de", '44' => "PEAR HTTP_Request", '45' => "Java/1.5.0_07", '46' => "BlogPulseLive(support@blogpulse.com)", '47' => "TrackBack", '48' => "Blogdimension", '49' => "Yahoo");
                            foreach ($banned_array as $ban) {
                                if (stristr($useragent, $ban) !== false) {
                                    $found = 1;
                                    break;
                                }
                            }
                        }
                        if ($found == 0) {
                            $this->countVisitor($useragent, $remoteaddr, $referer);
                        }
                    } else {
                        // Update visitor timestamp
                        $this->updateVisitor();
                    }
                    break;
                case 'css_backend':
                    ?>

.serendipity_statistics table {
    background: #eaeaea;
    background-image: -webkit-linear-gradient(#fff, #eaeaea);
    background-image: linear-gradient(#fff, #eaeaea);
    border-color: #ddd #bbb #999;
    color: #222;
    text-shadow: #fff 0 1px 1px;
    width: 100%;
}
.stats_imagecell {
    vertical-align: bottom;
}
.stats_header {
    width: auto;
    display: block;
    background: #eee;
}
.stats_header span {
    text-align: right;
    width: 50%;
    float: right;
}
.serendipity_statistics .wide_box dl {
    clear: left;
    display: table;
    width: 100%;
}
.serendipity_statistics .wide_box dt {
    display: table-row;
}
.serendipity_statistics .wide_box dd {
    margin-left: 0;
    padding: 0px 0.5em 0.5em 0;
}

<?php 
                    break;
                case 'backend_sidebar_entries':
                    if ($serendipity['version'][0] < 2) {
                        ?>
                        <li><a href="?serendipity[adminModule]=event_display&amp;serendipity[adminAction]=statistics"><?php 
                        echo PLUGIN_EVENT_STATISTICS_NAME;
                        ?>
</a></li>
<?php 
                    }
                    break;
                case 'backend_sidebar_admin_appearance':
                    if ($serendipity['version'][0] > 1) {
                        ?>
                        <li><a href="?serendipity[adminModule]=event_display&amp;serendipity[adminAction]=statistics"><?php 
                        echo PLUGIN_EVENT_STATISTICS_NAME;
                        ?>
</a></li>
<?php 
                    }
                    break;
                case 'backend_sidebar_entries_event_display_statistics':
                    $max_items = $this->get_config('max_items');
                    $ext_vis_stat = $this->get_config('ext_vis_stat');
                    if (!$max_items || !is_numeric($max_items) || $max_items < 1) {
                        $max_items = 20;
                    }
                    if ($ext_vis_stat == 'yesTop') {
                        $this->extendedVisitorStatistics($max_items);
                    }
                    if ($this->get_config('stat_all') == 'yes') {
                        $first_entry = serendipity_db_query("SELECT timestamp FROM {$serendipity['dbPrefix']}entries ORDER BY timestamp ASC limit 1", true);
                        $last_entry = serendipity_db_query("SELECT timestamp FROM {$serendipity['dbPrefix']}entries ORDER BY timestamp DESC limit 1", true);
                        $total_count = serendipity_db_query("SELECT count(id) FROM {$serendipity['dbPrefix']}entries", true);
                        $draft_count = serendipity_db_query("SELECT count(id) FROM {$serendipity['dbPrefix']}entries WHERE isdraft = 'true'", true);
                        $publish_count = serendipity_db_query("SELECT count(id) FROM {$serendipity['dbPrefix']}entries WHERE isdraft = 'false'", true);
                        $author_rows = serendipity_db_query("SELECT author, count(author) as entries FROM {$serendipity['dbPrefix']}entries GROUP BY author ORDER BY author");
                        $category_count = serendipity_db_query("SELECT count(categoryid) FROM {$serendipity['dbPrefix']}category", true);
                        $cat_sql = "SELECT c.category_name, count(e.id) as postings\n                                                        FROM {$serendipity['dbPrefix']}entrycat ec,\n                                                             {$serendipity['dbPrefix']}category c,\n                                                             {$serendipity['dbPrefix']}entries e\n                                                        WHERE ec.categoryid = c.categoryid AND ec.entryid = e.id\n                                                        GROUP BY ec.categoryid, c.category_name\n                                                        ORDER BY postings DESC";
                        $category_rows = serendipity_db_query($cat_sql);
                        $image_count = serendipity_db_query("SELECT count(id) FROM {$serendipity['dbPrefix']}images", true);
                        $image_rows = serendipity_db_query("SELECT extension, count(id) AS images FROM {$serendipity['dbPrefix']}images GROUP BY extension ORDER BY images DESC");
                        $subscriber_count = count(serendipity_db_query("SELECT count(id) FROM {$serendipity['dbPrefix']}comments WHERE type = 'NORMAL' AND subscribed = 'true' GROUP BY email"));
                        $subscriber_rows = serendipity_db_query("SELECT e.timestamp, e.id, e.title, count(c.id) as postings\n                                                        FROM {$serendipity['dbPrefix']}comments c,\n                                                             {$serendipity['dbPrefix']}entries e\n                                                        WHERE e.id = c.entry_id AND type = 'NORMAL' AND subscribed = 'true'\n                                                        GROUP BY e.id, c.email, e.title, e.timestamp\n                                                        ORDER BY postings DESC\n                                                        LIMIT {$max_items}");
                        $comment_count = serendipity_db_query("SELECT count(id) FROM {$serendipity['dbPrefix']}comments WHERE type = 'NORMAL'", true);
                        $comment_rows = serendipity_db_query("SELECT e.timestamp, e.id, e.title, count(c.id) as postings\n                                                        FROM {$serendipity['dbPrefix']}comments c,\n                                                             {$serendipity['dbPrefix']}entries e\n                                                        WHERE e.id = c.entry_id AND type = 'NORMAL'\n                                                        GROUP BY e.id, e.title, e.timestamp\n                                                        ORDER BY postings DESC\n                                                        LIMIT {$max_items}");
                        $commentor_rows = serendipity_db_query("SELECT author, max(email) as email, max(url) as url, count(id) as postings\n                                                        FROM {$serendipity['dbPrefix']}comments c\n                                                        WHERE type = 'NORMAL'\n                                                        GROUP BY author\n                                                        ORDER BY postings DESC\n                                                        LIMIT {$max_items}");
                        $tb_count = serendipity_db_query("SELECT count(id) FROM {$serendipity['dbPrefix']}comments WHERE type = 'TRACKBACK'", true);
                        $tb_rows = serendipity_db_query("SELECT e.timestamp, e.id, e.title, count(c.id) as postings\n                                                        FROM {$serendipity['dbPrefix']}comments c,\n                                                             {$serendipity['dbPrefix']}entries e\n                                                        WHERE e.id = c.entry_id AND type = 'TRACKBACK'\n                                                        GROUP BY e.timestamp, e.id, e.title\n                                                        ORDER BY postings DESC\n                                                        LIMIT {$max_items}");
                        $tbr_rows = serendipity_db_query("SELECT author, max(email) as email, max(url) as url, count(id) as postings\n                                                        FROM {$serendipity['dbPrefix']}comments c\n                                                        WHERE type = 'TRACKBACK'\n                                                        GROUP BY author\n                                                        ORDER BY postings DESC\n                                                        LIMIT {$max_items}");
                        $length = serendipity_db_query("SELECT SUM(LENGTH(body) + LENGTH(extended)) FROM {$serendipity['dbPrefix']}entries", true);
                        $length_rows = serendipity_db_query("SELECT id, title, (LENGTH(body) + LENGTH(extended)) as full_length FROM {$serendipity['dbPrefix']}entries ORDER BY full_length DESC LIMIT {$max_items}");
                        ?>
    <h2><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_STATISTICS;
                        ?>
</h2>

    <div class="serendipity_statistics clearfix">
        <section>
            <h3><?php 
                        echo ENTRIES;
                        ?>
</h3>

            <dl>
                <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_FIRST_ENTRY;
                        ?>
</dt>
                <dd><?php 
                        echo serendipity_formatTime(DATE_FORMAT_ENTRY . ' %H:%m', $first_entry[0]);
                        ?>
</dd>
                <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_LAST_ENTRY;
                        ?>
</dt>
                <dd><?php 
                        echo serendipity_formatTime(DATE_FORMAT_ENTRY . ' %H:%m', $last_entry[0]);
                        ?>
</dd>
                <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_TOTAL_ENTRIES;
                        ?>
</dt>
                <dd><?php 
                        echo $total_count[0];
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_ENTRIES;
                        ?>
                    <dl>
                        <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_TOTAL_PUBLIC;
                        ?>
</dt>
                        <dd><?php 
                        echo $publish_count[0];
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_ENTRIES;
                        ?>
</dd>
                        <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_TOTAL_DRAFTS;
                        ?>
</dt>
                        <dd><?php 
                        echo $draft_count[0];
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_ENTRIES;
                        ?>
</dd>
                    </dl>
                </dd>
            </dl>
        </section>

        <section>
            <h3><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_PER_AUTHOR;
                        ?>
</h3>

            <dl>
<?php 
                        if (is_array($author_rows)) {
                            foreach ($author_rows as $author => $author_stat) {
                                ?>
                <dt><?php 
                                echo $author_stat['author'];
                                ?>
</dt>
                <dd><?php 
                                echo $author_stat['entries'];
                                ?>
 <?php 
                                echo PLUGIN_EVENT_STATISTICS_OUT_ENTRIES;
                                ?>
 (<?php 
                                echo 100 * round($author_stat['entries'] / max($total_count[0], 1), 3);
                                ?>
%)</dd>
<?php 
                            }
                        }
                        ?>
            </dl>
        </section>

        <section>
            <h3><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_CATEGORIES;
                        ?>
</h3>

            <p><?php 
                        echo $category_count[0];
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_CATEGORIES2;
                        ?>
</p>

            <h4><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_DISTRIBUTION_CATEGORIES;
                        ?>
</h4>

            <dl>
<?php 
                        if (is_array($category_rows)) {
                            foreach ($category_rows as $category => $cat_stat) {
                                ?>
                <dt><?php 
                                echo $cat_stat['category_name'];
                                ?>
</dt>
                <dd><?php 
                                echo $cat_stat['postings'];
                                ?>
 <?php 
                                echo PLUGIN_EVENT_STATISTICS_OUT_DISTRIBUTION_CATEGORIES2;
                                ?>
</dd>
<?php 
                            }
                        }
                        ?>
            </dl>
        </section>

        <section>
            <h3><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_UPLOADED_IMAGES;
                        ?>
</h3>

            <p><?php 
                        echo $image_count[0];
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_UPLOADED_IMAGES2;
                        ?>
</p>

            <h4><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_DISTRIBUTION_IMAGES;
                        ?>
</h4>

            <dl>
<?php 
                        if (is_array($image_rows)) {
                            foreach ($image_rows as $image => $image_stat) {
                                ?>
                <dt><?php 
                                echo $image_stat['extension'];
                                ?>
</dt>
                <dd><?php 
                                echo $image_stat['images'];
                                ?>
 <?php 
                                echo PLUGIN_EVENT_STATISTICS_OUT_DISTRIBUTION_IMAGES2;
                                ?>
</dd>
<?php 
                            }
                        }
                        ?>
            </dl>
        </section>

        <section>
            <h3><?php 
                        echo COMMENTS;
                        ?>
</h3>

            <dl>
                <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS;
                        ?>
</dt>
                <dd><?php 
                        echo $comment_count[0];
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS2;
                        ?>
</dd>
            </dl>

            <h4><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS3;
                        ?>
</h4>

            <dl>
<?php 
                        if (is_array($comment_rows)) {
                            foreach ($comment_rows as $comment => $com_stat) {
                                ?>
                <dt><a href="<?php 
                                echo serendipity_archiveURL($com_stat['id'], $com_stat['title'], 'serendipityHTTPPath', true, array('timestamp' => $com_stat['timestamp']));
                                ?>
"><?php 
                                echo $com_stat['title'];
                                ?>
</a></dt>
                <dd><?php 
                                echo $com_stat['postings'];
                                ?>
 <?php 
                                echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS2;
                                ?>
</dd>
<?php 
                            }
                        }
                        ?>
            </dl>
        </section>

        <section>
            <h3><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_TOPCOMMENTS;
                        ?>
</h3>

            <dl>
<?php 
                        if (is_array($commentor_rows)) {
                            foreach ($commentor_rows as $comment => $com_stat) {
                                $link_start = '';
                                $link_end = '';
                                $link_url = '';
                                if (!empty($com_stat['email'])) {
                                    $link_start = '<a href="mailto:' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($com_stat['email']) : htmlspecialchars($com_stat['email'], ENT_COMPAT, LANG_CHARSET)) . '">';
                                    $link_end = '</a>';
                                }
                                if (!empty($com_stat['url'])) {
                                    if (substr($com_stat['url'], 0, 7) != 'http://' && substr($com_stat['url'], 0, 8) != 'https://') {
                                        $com_stat['url'] = 'http://' . $com_stat['url'];
                                    }
                                    $link_url = ' (<a href="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($com_stat['url']) : htmlspecialchars($com_stat['url'], ENT_COMPAT, LANG_CHARSET)) . '">' . PLUGIN_EVENT_STATISTICS_OUT_LINK . '</a>)';
                                }
                                if (empty($com_stat['author'])) {
                                    $com_stat['author'] = ANONYMOUS;
                                }
                                ?>
                <dt><?php 
                                echo $link_start . $com_stat['author'] . $link_end . $link_url;
                                ?>
 </dt>
                <dd><?php 
                                echo $com_stat['postings'];
                                ?>
 <?php 
                                echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS2;
                                ?>
</dd>
<?php 
                            }
                        }
                        ?>
            </dl>
        </section>

        <section>
            <h3><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_SUBSCRIBERS;
                        ?>
</h3>

            <p><?php 
                        echo $subscriber_count;
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_SUBSCRIBERS2;
                        ?>
</p>

            <h4><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_TOPSUBSCRIBERS;
                        ?>
</h4>

            <dl>
<?php 
                        if (is_array($subscriber_rows)) {
                            foreach ($subscriber_rows as $subscriber => $subscriber_stat) {
                                ?>
                <dt><a href="<?php 
                                echo serendipity_archiveURL($subscriber_stat['id'], $subscriber_stat['title'], 'serendipityHTTPPath', true, array('timestamp' => $subscriber_stat['timestamp']));
                                ?>
"><?php 
                                echo $subscriber_stat['title'];
                                ?>
</a></dt>
                <dd><?php 
                                echo $subscriber_stat['postings'];
                                ?>
 <?php 
                                echo PLUGIN_EVENT_STATISTICS_OUT_TOPSUBSCRIBERS2;
                                ?>
</dd>
<?php 
                            }
                        }
                        ?>
            </dl>
        </section>

        <section>
            <h3><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_TRACKBACKS;
                        ?>
</h3>

            <p><?php 
                        echo $tb_count[0];
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_TRACKBACKS2;
                        ?>
</p>

            <h4><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_TOPTRACKBACK;
                        ?>
</h4>

            <dl>
<?php 
                        if (is_array($tb_rows)) {
                            foreach ($tb_rows as $tb => $tb_stat) {
                                ?>
                <dt><a href="<?php 
                                echo serendipity_archiveURL($tb_stat['id'], $tb_stat['title'], 'serendipityHTTPPath', true, array('timestamp' => $tb_stat['timestamp']));
                                ?>
"><?php 
                                echo $tb_stat['title'];
                                ?>
</a></dt>
                <dd><?php 
                                echo $tb_stat['postings'];
                                ?>
 <?php 
                                echo PLUGIN_EVENT_STATISTICS_OUT_TOPTRACKBACK2;
                                ?>
</dd>
<?php 
                            }
                        }
                        ?>
            </dl>
        </section>

        <section>
            <h3><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_TOPTRACKBACKS3;
                        ?>
</h3>

            <dl>
<?php 
                        if (is_array($tbr_rows)) {
                            foreach ($tbr_rows as $tb => $tb_stat) {
                                if (empty($tb_stat['author'])) {
                                    $tb_stat['author'] = ANONYMOUS;
                                }
                                ?>
                <dt><a href="<?php 
                                echo function_exists('serendipity_specialchars') ? serendipity_specialchars($tb_stat['url']) : htmlspecialchars($tb_stat['url'], ENT_COMPAT, LANG_CHARSET);
                                ?>
"><?php 
                                echo function_exists('serendipity_specialchars') ? serendipity_specialchars($tb_stat['author']) : htmlspecialchars($tb_stat['author'], ENT_COMPAT, LANG_CHARSET);
                                ?>
</a></dt>
                <dd><?php 
                                echo $tb_stat['postings'];
                                ?>
 <?php 
                                echo PLUGIN_EVENT_STATISTICS_OUT_TOPTRACKBACK2;
                                ?>
</dd>
<?php 
                            }
                        }
                        ?>
            </dl>
        </section>

        <section>
            <h3>(Needs a heading)</h3>

            <dl>
                <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS_PER_ARTICLE;
                        ?>
</dt>
                <dd><?php 
                        echo round($comment_count[0] / max($publish_count[0], 1), 2);
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS_PER_ARTICLE2;
                        ?>
</dd>
                <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_TRACKBACKS_PER_ARTICLE;
                        ?>
</dt>
                <dd><?php 
                        echo round($tb_count[0] / max($publish_count[0], 1), 2);
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_TRACKBACKS_PER_ARTICLE2;
                        ?>
</dd>
                <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_ARTICLES_PER_DAY;
                        ?>
</dt>
                <dd><?php 
                        echo round($publish_count[0] / ((time() - $first_entry[0]) / (60 * 60 * 24)), 2);
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_ARTICLES_PER_DAY2;
                        ?>
</dd>
                <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_ARTICLES_PER_WEEK;
                        ?>
</dt>
                <dd><?php 
                        echo round($publish_count[0] / ((time() - $first_entry[0]) / (60 * 60 * 24 * 7)), 2);
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_ARTICLES_PER_WEEK2;
                        ?>
</dd>
                <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_ARTICLES_PER_MONTH;
                        ?>
</dt>
                <dd><?php 
                        echo round($publish_count[0] / ((time() - $first_entry[0]) / (60 * 60 * 24 * 31)), 2);
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_ARTICLES_PER_MONTH2;
                        ?>
</dd>
                <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_CHARS;
                        ?>
</dt>
                <dd><?php 
                        echo $length[0];
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_CHARS2;
                        ?>
</dd>
                <dt><?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_CHARS_PER_ARTICLE;
                        ?>
</dt>
                <dd><?php 
                        echo round($length[0] / max($publish_count[0], 1), 2);
                        ?>
 <?php 
                        echo PLUGIN_EVENT_STATISTICS_OUT_CHARS_PER_ARTICLE2;
                        ?>
</dd>
            </dl>
        </section>

        <section>
            <h3><?php 
                        printf(PLUGIN_EVENT_STATISTICS_OUT_LONGEST_ARTICLES, $max_items);
                        ?>
</h3>

            <dl>
<?php 
                        if (is_array($length_rows)) {
                            foreach ($length_rows as $tb => $length_stat) {
                                ?>
                <dt><a href="<?php 
                                echo serendipity_archiveURL($length_stat['id'], $length_stat['title'], 'serendipityHTTPPath', true, array('timestamp' => $length_stat['timestamp']));
                                ?>
"><?php 
                                echo $length_stat['title'];
                                ?>
</a></dt>
                <dd><?php 
                                echo $length_stat['full_length'];
                                ?>
 <?php 
                                echo PLUGIN_EVENT_STATISTICS_OUT_CHARS2;
                                ?>
</dd>
<?php 
                            }
                        }
                        ?>
            </dl>
        </section>

        <section>
            <h3><?php 
                        echo TOP_REFERRER;
                        ?>
</h3>

            <?php 
                        echo serendipity_displayTopReferrers($max_items, true);
                        ?>
        </section>

        <section>
            <h3><?php 
                        echo TOP_EXITS;
                        ?>
</h3>

            <?php 
                        echo serendipity_displayTopExits($max_items, true);
                        ?>
        </section>
    <?php 
                        serendipity_plugin_api::hook_event('event_additional_statistics', $eventData, array('maxitems' => $max_items));
                        ?>
    </div>
<?php 
                    }
                    if ($ext_vis_stat == 'yesBot') {
                        $this->extendedVisitorStatistics($max_items);
                    }
                    return true;
                    break;
                default:
                    return false;
                    break;
            }
        } else {
            return false;
        }
    }