]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/publictagcloud.php
Don't spew notices when building tag cloud if there is no popularity sum to divide by.
[quix0rs-gnu-social.git] / actions / publictagcloud.php
index e7f6ee36c736552bc33817bf5018940ea0e1d254..5c707402905df7dcd0f9665950384849440992b0 100644 (file)
@@ -136,7 +136,12 @@ class PublictagcloudAction extends Action
             $this->elementStart('dd');
             $this->elementStart('ul', 'tags xoxo tag-cloud');
             foreach ($tw as $tag => $weight) {
-                $this->showTag($tag, $weight, $weight/$sum);
+                if ($sum) {
+                    $weightedSum = $weight/$sum;
+                } else {
+                    $weightedSum = 1;
+                }
+                $this->showTag($tag, $weight, $weightedSum);
             }
             $this->elementEnd('ul');
             $this->elementEnd('dd');