Prevented SQL errors when there are no subcategories
Needs work - prevented every query from containing a different timestamp. Allows Query cache to function. Need to add a control somewhere