I\'ve found this nice jekyll theme: http://www.jacoporabolini.com/emerald/ with good looking pagination. Unfortunately is only good looking when there is a small number of p
I wrote a Liquid {% include %}
that does what you are looking for. Jekyll Paginator Links.
I based it on the logic you used (min/max), but it has a bit more math built in as well. It's customizable with CSS so it should be able to do what you have described. I hope it does what you need it to! If not, submit an issue on GitHub.