prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Paginator returns wrong rec_end() result
  When record is last one on it's own on the last page, rec_end() incorrectly shows 1, instead of rec_total() value.
  
  
  </issue>
  <code>
  [start of cfme/web_ui/paginator.py]
  1 """A set of functions for dealing with the paginator controls."""
  2 import cfme.fixtures.pytest_selenium as sel
  3 import re
  4 
  5 _locator = '(//div[@id="paging_div"] | //div[@id="records_div"])'
  6 _next = '//img[@alt="Next"]'
  7 _previous = '//img[@alt="Previous"]'
  8 _first = '//img[@alt="First"]'
  9 _last = '//img[@alt="Last"]'
  10 _num_results = '//select[@id="ppsetting" or @id="perpage_setting1"]'
  11 _sort_by = '//select[@id="sort_choice"]'
  12 _page_cell = '//td//td[contains(., " of ")]'
  13 _check_all = '//input[@id="masterToggle"]'
  14 
  15 
  16 def _page_nums():
  17     return sel.element(_locator + _page_cell).text
  18 
  19 
  20 def check_all():
  21     """ Returns the Check All locator."""
  22     return sel.element(_locator + _check_all)
  23 
  24 
  25 def next():
  26     """ Returns the Next button locator."""
  27     btn = sel.element(_locator + _next)
  28     return btn
  29 
  30 
  31 def previous():
  32     """ Returns the Previous button locator."""
  33     btn = sel.element(_locator + _previous)
  34     return btn
  35 
  36 
  37 def first():
  38     """ Returns the First button locator."""
  39     btn = sel.element(_locator + _first)
  40     return btn
  41 
  42 
  43 def last():
  44     """ Returns the Last button locator."""
  45     btn = sel.element(_locator + _last)
  46     return btn
  47 
  48 
  49 def results_per_page(num):
  50     """ Changes the number of results on a page.
  51 
  52     Args:
  53         num: A string, or a tuple of (type, value).
  54     """
  55     select = sel.element(_locator + _num_results)
  56     sel.select(select, num)
  57 
  58 
  59 def sort_by(sort):
  60     """ Changes the sort by field.
  61 
  62     Args:
  63         num: A string, or a tuple of (type, value).
  64     """
  65     select = sel.element(_locator + _sort_by)
  66     sel.select(select, sort)
  67 
  68 
  69 def rec_offset():
  70     """ Returns the first record offset."""
  71     offset = re.search('\((Item|Items)*\s*(\d+)', _page_nums())
  72     return offset.groups()[1]
  73 
  74 
  75 def rec_end():
  76     """ Returns the record set index."""
  77     offset = re.search('-(\d+)', _page_nums())
  78     if offset:
  79         return offset.groups()[0]
  80     else:
  81         return '1'
  82 
  83 
  84 def rec_total():
  85     """ Returns the total number of records."""
  86     offset = re.search('(\d+)\)', _page_nums())
  87     return offset.groups()[0]
  88
  [end of cfme/web_ui/paginator.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/cfme/web_ui/paginator.py b/cfme/web_ui/paginator.py
  --- a/cfme/web_ui/paginator.py
  +++ b/cfme/web_ui/paginator.py
  @@ -78,7 +78,7 @@
       if offset:
           return offset.groups()[0]
       else:
  -        return '1'
  +        return rec_total()
   
   
   def rec_total():
  
verification_info: {"golden_diff": "diff --git a/cfme/web_ui/paginator.py b/cfme/web_ui/paginator.py\n--- a/cfme/web_ui/paginator.py\n+++ b/cfme/web_ui/paginator.py\n@@ -78,7 +78,7 @@\n     if offset:\n         return offset.groups()[0]\n     else:\n-        return '1'\n+        return rec_total()\n \n \n def rec_total():\n", "issue": "Paginator returns wrong rec_end() result\nWhen record is last one on it's own on the last page, rec_end() incorrectly shows 1, instead of rec_total() value.\n\n", "before_files": [{"content": "\"\"\"A set of functions for dealing with the paginator controls.\"\"\"\nimport cfme.fixtures.pytest_selenium as sel\nimport re\n\n_locator = '(//div[@id=\"paging_div\"] | //div[@id=\"records_div\"])'\n_next = '//img[@alt=\"Next\"]'\n_previous = '//img[@alt=\"Previous\"]'\n_first = '//img[@alt=\"First\"]'\n_last = '//img[@alt=\"Last\"]'\n_num_results = '//select[@id=\"ppsetting\" or @id=\"perpage_setting1\"]'\n_sort_by = '//select[@id=\"sort_choice\"]'\n_page_cell = '//td//td[contains(., \" of \")]'\n_check_all = '//input[@id=\"masterToggle\"]'\n\n\ndef _page_nums():\n    return sel.element(_locator + _page_cell).text\n\n\ndef check_all():\n    \"\"\" Returns the Check All locator.\"\"\"\n    return sel.element(_locator + _check_all)\n\n\ndef next():\n    \"\"\" Returns the Next button locator.\"\"\"\n    btn = sel.element(_locator + _next)\n    return btn\n\n\ndef previous():\n    \"\"\" Returns the Previous button locator.\"\"\"\n    btn = sel.element(_locator + _previous)\n    return btn\n\n\ndef first():\n    \"\"\" Returns the First button locator.\"\"\"\n    btn = sel.element(_locator + _first)\n    return btn\n\n\ndef last():\n    \"\"\" Returns the Last button locator.\"\"\"\n    btn = sel.element(_locator + _last)\n    return btn\n\n\ndef results_per_page(num):\n    \"\"\" Changes the number of results on a page.\n\n    Args:\n        num: A string, or a tuple of (type, value).\n    \"\"\"\n    select = sel.element(_locator + _num_results)\n    sel.select(select, num)\n\n\ndef sort_by(sort):\n    \"\"\" Changes the sort by field.\n\n    Args:\n        num: A string, or a tuple of (type, value).\n    \"\"\"\n    select = sel.element(_locator + _sort_by)\n    sel.select(select, sort)\n\n\ndef rec_offset():\n    \"\"\" Returns the first record offset.\"\"\"\n    offset = re.search('\\((Item|Items)*\\s*(\\d+)', _page_nums())\n    return offset.groups()[1]\n\n\ndef rec_end():\n    \"\"\" Returns the record set index.\"\"\"\n    offset = re.search('-(\\d+)', _page_nums())\n    if offset:\n        return offset.groups()[0]\n    else:\n        return '1'\n\n\ndef rec_total():\n    \"\"\" Returns the total number of records.\"\"\"\n    offset = re.search('(\\d+)\\)', _page_nums())\n    return offset.groups()[0]\n", "path": "cfme/web_ui/paginator.py"}]}