wp_logout_url redirects to incorrect page because of pagination

It’s not clear, but I’m assuming you want a ‘log out’ url, that brings the user back to the current page?

get_permalink() however, get’s the permalink of the current post in the loop (if you’re using it outside the loop, you’ll find that it takes the user to the last post in the loop after they log out).

To get the url of whatever page you’re currently on, you can use $_SERVER['REQUEST_URI']; (if there is a WordPress function that does this, apart from using add_query_arg() I would like to know it…)

So try:

 wp_logout_url( $_SERVER['REQUEST_URI'] );