Custom Pagination Code Help

I’m using the paginate_links( $args ) function in a loop in my site. And I’m also using a filter in the loop to filter the posts under different taxonomies. The problem is, when I filter the posts, some query strings are added to the URL of the page. Now, when I use the pagination links to go to the next page, the query strings stay added to the URL. Any ideas on how I could avoid that?

Here’s the full code I’m using: