QueryString is now appended to page links

I need  append to page links the query string (&category_id=2 for example).
This code allows do it
Please remove the extra spaces around this. Basically, follow psr-2.