don't try to get the last log entry if there aren't any
fix GetQueryString() for select queries with regex