Extend Pagination to have skip X inbetween pages

I keep running into an issue that there are so many posts in my pagination they start to go into two lines. It would be great if we could paginate every X pages. Something like this:

Prev 1 … 5 … 10 … 15 … 18 Next

Thanks for considering.