Use lstrip() instead of string indexing [MJ-751]

If there is no query string in the logs, indexing into this string will fail. Use lstrip instead.

All tests pass.