Fix notice thrown when the index query is undefined

I get a notice thrown when no query string is provided in the original url, this should help mitigate it.