Update of /cvsroot/php-blog/serendipity/plugins/serendipity_event_statistics
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31070
Modified Files:
serendipity_event_statistics.php
Log Message:
fix division by zero on empty article base
Index: serendipity_event_statistics.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_event_statistics/serendipity_event_statistics.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- serendipity_event_statistics.php 8 Jan 2005 12:25:12 -0000 1.18
+++ serendipity_event_statistics.php 17 Jan 2005 11:43:25 -0000 1.19
@@ -424,11 +424,11 @@
<br />
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS_PER_ARTICLE; ?></strong></dt>
- <dd><?php echo round($comment_count[0] / $publish_count[0], 2); ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS_PER_ARTICLE;2 ?></dd>
+ <dd><?php echo round($comment_count[0] / max($publish_count[0], 1), 2); ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS_PER_ARTICLE;2 ?></dd>
<br />
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_TRACKBACKS_PER_ARTICLE; ?></strong></dt>
- <dd><?php echo round($tb_count[0] / $publish_count[0], 2); ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_TRACKBACKS_PER_ARTICLE2; ?></dd>
+ <dd><?php echo round($tb_count[0] / max($publish_count[0], 1), 2); ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_TRACKBACKS_PER_ARTICLE2; ?></dd>
<br />
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_ARTICLES_PER_DAY; ?></strong></dt>
@@ -450,7 +450,7 @@
<br />
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_CHARS_PER_ARTICLE; ?></strong></dt>
- <dd><?php echo round($length[0] / $publish_count[0], 2); ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_CHARS_PER_ARTICLE2; ?></dd>
+ <dd><?php echo round($length[0] / max($publish_count[0], 1), 2); ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_CHARS_PER_ARTICLE2; ?></dd>
<br />
<dt><strong><?php printf(PLUGIN_EVENT_STATISTICS_OUT_LONGEST_ARTICLES, $max_items); ?></strong></dt>
|