This line is causing my log files to fill with Undefined Index
$calculated[$tag_id] > 0 ? $calculated[$tag_id] = $calculated[$tag_id]+1 : $calculated[$tag_id] = 1;
Any help would be highly appreciated.
Maybe make the ternary operation equal to a variable , instead of setting the array key in the operation
$calculated[$tag_id] = ($calculated[$tag_id] > 0) ? $calculated[$tag_id] + 1 : 1;