We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cfme/web_ui/paginator.py`
Content:
```
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 FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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():

{"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"}], "after_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 rec_total()\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"}]}