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 use psr-2 style braces.