docs: def pager(
          self,
          format="~2~",
          url=None,
          show_if_single_page=False,
          separator=" ",
          symbol_first="&lt;&lt;",
          symbol_last="&gt;&gt;",
          symbol_previous="&lt;",
          symbol_next="&gt;",
          link_attr=None,
          curpage_attr=None,
          dotdot_attr=None,
          link_tag=None,
      ):
          """
          Return string with links to other pages (e.g. '1 .. 5 6 7 [8] 9 10 11 .. 50').
  
          format:
              Format string that defines how the pager is rendered. The string
              can contain the following $-tokens that are substituted by the
              string.Template module:
  
              - $first_page: number of first reachable page
              - $last_page: number of last reachable page
              - $page: number of currently selected page
              - $page_count: number of reachable pages
              - $items_per_page: maximal number of items per page
              - $first_item: index of first item on the current page
              - $last_item: index of last item on the current page
              - $item_count: total number of items
              - $link_first: link to first page (unless this is first page)
              - $link_last: link to last page (unless this is last page)
              - $link_previous: link to previous page (unless this is first page)
              - $link_next: link to next page (unless this is last page)
  
              To render a range of pages the token '~3~' can be used. The
              number sets the radius of pages around the current page.
              Example for a range with radius 3:
  
              '1 .. 5 6 7 [8] 9 10 11 .. 50'
  
              Default: '~2~'
  
          url
              The URL that page links will point to. Make sure it contains the string
              $page which will be replaced by the actual page number.
              Must be given unless a url_maker is specified to __init__, in which
              case this parameter is ignored.
  
          symbol_first
              String to be displayed as the text for the $link_first link above.
  
              Default: '&lt;&lt;' (<<)
  
          symbol_last
              String to be displayed as the text for the $link_last link above.
  
              Default: '&gt;&gt;' (>>)
  
          symbol_previous
              String to be displayed as the text for the $link_previous link above.
  
              Default: '&lt;' (<)
  
          symbol_next
              String to be displayed as the text for the $link_next link above.
  
              Default: '&gt;' (>)
  
          separator:
              String that is used to separate page links/numbers in the above range of pages.
  
              Default: ' '
  
          show_if_single_page:
              if True the navigator will be shown even if there is only one page.
  
              Default: False
  
          link_attr (optional)
              A dictionary of attributes that get added to A-HREF links pointing to other pages. Can
              be used to define a CSS style or class to customize the look of links.
  
              Example: { 'style':'border: 1px solid green' }
              Example: { 'class':'pager_link' }
  
          curpage_attr (optional)
              A dictionary of attributes that get added to the current page number in the pager (which
              is obviously not a link). If this dictionary is not empty then the elements will be
              wrapped in a SPAN tag with the given attributes.
  
              Example: { 'style':'border: 3px solid blue' }
              Example: { 'class':'pager_curpage' }
  
          dotdot_attr (optional)
              A dictionary of attributes that get added to the '..' string in the pager (which is
              obviously not a link). If this dictionary is not empty then the elements will be wrapped
              in a SPAN tag with the given attributes.
  
              Example: { 'style':'color: #808080' }
              Example: { 'class':'pager_dotdot' }
  
          link_tag (optional)
              A callable that accepts single argument `page` (page link information)
              and generates string with html that represents the link for specific page.
              Page objects are supplied from `link_map()` so the keys are the same.
  
  
          """
          link_attr = link_attr or {}
          curpage_attr = curpage_attr or {}
          dotdot_attr = dotdot_attr or {}
          self.curpage_attr = curpage_attr
          self.separator = separator
          self.link_attr = link_attr
          self.dotdot_attr = dotdot_attr
          self.url = url
          self.link_tag = link_tag or self.default_link_tag
  
          # Don't show navigator if there is no more than one page
          if self.page_count == 0 or (self.page_count == 1 and not show_if_single_page):
              return ""
  
          regex_res = re.search(r"~(\d+)~", format)
          if regex_res:
              radius = regex_res.group(1)
          else:
              radius = 2
          radius = int(radius)
          self.radius = radius
          link_map = self.link_map(
              format=format,
              url=url,
              show_if_single_page=show_if_single_page,
              separator=separator,
              symbol_first=symbol_first,
              symbol_last=symbol_last,
              symbol_previous=symbol_previous,
              symbol_next=symbol_next,
              link_attr=link_attr,
              curpage_attr=curpage_attr,
              dotdot_attr=dotdot_attr,
          )
          links_markup = self._range(link_map, radius)
  
          # Replace ~...~ in token format by range of pages
          result = re.sub(r"~(\d+)~", links_markup, format)
  
          link_first = (
              self.page > self.first_page and self.link_tag(link_map["first_page"]) or ""
          )
          link_last = (
              self.page < self.last_page and self.link_tag(link_map["last_page"]) or ""
          )
          link_previous = (
              self.previous_page and self.link_tag(link_map["previous_page"]) or ""
          )
          link_next = self.next_page and self.link_tag(link_map["next_page"]) or ""
          # Interpolate '$' variables
          result = Template(result).safe_substitute(
              {
                  "first_page": self.first_page,
                  "last_page": self.last_page,
                  "page": self.page,
                  "page_count": self.page_count,
                  "items_per_page": self.items_per_page,
                  "first_item": self.first_item,
                  "last_item": self.last_item,
                  "item_count": self.item_count,
                  "link_first": link_first,
                  "link_last": link_last,
                  "link_previous": link_previous,
                  "link_next": link_next,
              }
          )
  
          return result