TagCloud Plugin - Division Zero

By iaenus

There is this message in the server:

[26-Aug-2010 19:57:26] WARNING: 2010-08-26 19:57:26 (CEST): "Division by zero" in file /usr/home/chironweb.org/web/redsocial/mod/wp1/views/default/output/tagcloud.php (line 51)

The tagcloud.php line 33 ....

 $temp = randomize_array($vars['tagcloud']);
        $cloud = "";
        $max = 0;
        foreach($temp as $tag) {
        // BUG FIX: UPDATE TO ENSURE WE DONT COUNT BLANKS
        if ( $tag->tag != "" ) {
            if ($tag->total > $max) {
                $max = $tag->total;
            }
           }
        }
        foreach($temp as $tag) {
            if (!empty($cloud))
          $cloud .= ", ";
        // BUG FIX: UPDATE TO ENSURE WE DONT COUNT BLANKS
        if ( $tag->tag != "" ) {
              $size = round((log($tag->total) / log($max)) * 100) + 30;
              if ($size < 60)
                $size = 60;
              $cloud .= "<a href=\"" . $vars['url'] . "search/?tag=". urlencode($tag->tag) . $object . $subtype . "\" style=\"font-size: {$size}%\" title=\"".addslashes($tag->tag)." ({$tag->total})\" style=\"text-decoration:none;\">" .$tag->tag . "</a>";
        }
        }

May be change $max = 1, this is correct?