fixes bug 965044 - Query signature URLs without a valid version raises a...

... SQL syntax error

@AdrianGaudebert r?

In hindsight, I think this is quite a tiny use case of fuzzying. I got started and I thought I'd finish. This should hopefully prevent us a little bit better from accidentally sending the middleware broken parameters.