Fix link issue in database query duplicate logging of debug plugin

When enabling debug mode, if there are duplicated database queries, the linking using hash is incorrect, when clicking those hash links, it will return an URL with no query string

For example, the current URL:

http://abc.com/index.php/search?a=1&b=2&c=3

Clicking on those hash links will return

http://abc.com/index.php/search#abc