Bug 836065: fix URL generation and log query