+>>> p = Paginator(range(31), 2)
+>>> paginate({'paginator': p, 'page_obj': p.page(2)}, 2, 2)['pages']
+[1, 2, 3, 4, 5, None, 15, 16]
+
+>>> p = Paginator(range(31), 2)
+>>> paginate({'paginator': p, 'page_obj': p.page(3)}, 2, 2)['pages']
+[1, 2, 3, 4, 5, None, 15, 16]
+
+>>> p = Paginator(range(31), 2)
+>>> paginate({'paginator': p, 'page_obj': p.page(4)}, 2, 2)['pages']
+[1, 2, 3, 4, 5, 6, None, 15, 16]
+
+>>> p = Paginator(range(31), 2)
+>>> paginate({'paginator': p, 'page_obj': p.page(5)}, 2, 2)['pages']
+[1, 2, 3, 4, 5, 6, 7, None, 15, 16]
+
+# in the middle
+>>> p = Paginator(range(31), 2)
+>>> paginate({'paginator': p, 'page_obj': p.page(7)}, 2, 2)['pages']
+[1, 2, None, 5, 6, 7, 8, 9, None, 15, 16]
+
+# on end
+>>> p = Paginator(range(31), 2)
+>>> paginate({'paginator': p, 'page_obj': p.page(16)}, 2, 2)['pages']
+[1, 2, None, 12, 13, 14, 15, 16]
+
+>>> p = Paginator(range(31), 2)
+>>> paginate({'paginator': p, 'page_obj': p.page(13)}, 2, 2)['pages']
+[1, 2, None, 11, 12, 13, 14, 15, 16]
+
+
+>>> p = Paginator(range(0), 2)