Open fullsize_hist.php, find
starttable('100%','most viewed albums');
$query = "SELECT alb.title,SUM(pic.hits) AS ahits, COUNT(*) FROM $atab AS alb, $ptab AS pic WHERE pic.aid=alb.aid GROUP BY alb.aid ORDER BY ahits DESC";
$res = cpg_db_query( $query );
echo "<tr><td><table CELLPADDING=\"5\">\n";
echo "<b><tr class=\"tableb\">\n";
echo "<td>\n";
echo "<b>album name</b>";
echo "</td>\n";
echo "<td>\n";
echo "<b>images in album</b>";
echo "</td>\n";
echo "<td>\n";
echo "<b>total hits in album</b>";
echo "</td>\n";
echo "</tr></b>\n";
while($row = mysql_fetch_row($res))
{
echo "<tr class=\"tableb\">\n";
echo "<td>\n";
echo $row[0];
echo "</td>\n";
echo "<td>\n";
echo $row[2];
echo "</td>\n";
echo "<td>\n";
echo $row[1];
echo "</td>\n";
echo "</tr>\n";
}
echo "</table></td></tr>\n";
mysql_free_result($res);
endtable(); // album statistics
and replace with
starttable('100%','most viewed albums');
$query = "SELECT alb.title,SUM(pic.hits) AS ahits, COUNT(*), cat.name
FROM {$CONFIG['TABLE_ALBUMS']} AS alb
INNER JOIN {$CONFIG['TABLE_PICTURES']} AS pic
ON pic.aid=alb.aid
LEFT JOIN {$CONFIG['TABLE_CATEGORIES']} AS cat
ON cat.cid=alb.category
GROUP BY alb.aid
ORDER BY ahits DESC";
$res = cpg_db_query( $query );
echo "<tr><td><table CELLPADDING=\"5\">\n";
echo "<b><tr class=\"tableb\">\n";
echo "<td>\n";
echo "<b>category</b>";
echo "</td>\n";
echo "<td>\n";
echo "<b>album name</b>";
echo "</td>\n";
echo "<td>\n";
echo "<b>images in album</b>";
echo "</td>\n";
echo "<td>\n";
echo "<b>total hits in album</b>";
echo "</td>\n";
echo "</tr></b>\n";
while($row = mysql_fetch_row($res))
{
echo "<tr class=\"tableb\">\n";
echo "<td>\n";
echo $row[3];
echo "</td>\n";
echo "<td>\n";
echo $row[0];
echo "</td>\n";
echo "<td>\n";
echo $row[2];
echo "</td>\n";
echo "<td>\n";
echo $row[1];
echo "</td>\n";
echo "</tr>\n";
}
echo "</table></td></tr>\n";
mysql_free_result($res);
endtable(); // album statistics