Updated the category terms layout to check for the existence of the "categories" parameter before attempting to access its length, preventing potential errors.