Update to use the correct index for the day date format, and to use has_key? when checking for a template during pagination.