I've noticed that with the current implementation, next arrow is still shown if there are no more pages.
By setting prev_next to true, WordPress should handle the generation of next and previous arrows.
This also means that the code is dramatically simplified.
But please test this, because I don't remember why I didn't write the code this way in the first place.
Maybe because there was some fringe case I tried to rectify?