We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Bad links on HMF browse pages
A report from the bug report system, from Paul Gunnells:  

"On 

https://www.lmfdb.org/ModularForm/GL2/TotallyReal/browse/2/ 

the links in the middle column (the Number of newforms column) are all the same and point to https://www.lmfdb.org/ModularForm/GL2/TotallyReal/?field_label=2.2.497.1 instead of urls the modular form data they're supposed to."

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `lmfdb/hilbert_modular_forms/hmf_stats.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 from flask import url_for
3 from lmfdb import db
4 from lmfdb.utils import comma
5 from lmfdb.utils.display_stats import StatsDisplay, proportioners, totaler
6 from lmfdb.logger import make_logger
7 from lmfdb.number_fields.web_number_field import nf_display_knowl
8 from sage.misc.cachefunc import cached_method
9 
10 logger = make_logger("hmf")
11 
12 class HMFstats(StatsDisplay):
13     """
14     Class for creating and displaying statistics for Hilbert modular forms
15     """
16     def __init__(self):
17         self.nforms = db.hmf_forms.count()
18 
19     table = db.hmf_forms
20     baseurl_func = ".hilbert_modular_form_render_webpage"
21 
22     stat_list = [
23         {'cols': ['level_norm', 'deg'],
24          'totaler': totaler(),
25          'proportioner': proportioners.per_col_total},
26         {'cols': ['level_norm', 'dimension'],
27          'totaler': totaler(),
28          'proportioner': proportioners.per_col_total},
29     ]
30     buckets = {'level_norm': ['1', '2-10', '11-100', '101-1000', '1001-10000'],
31                'dimension': ['1', '2', '3', '4', '5-10', '11-20', '21-100', '101-1000']}
32     knowls = {'level_norm': 'mf.hilbert.level_norm',
33               'dimension': 'mf.hilbert.dimension',
34               'deg': 'nf.degree'}
35     short_display = {'deg': 'degree'}
36 
37     @property
38     def short_summary(self):
39         return self.summary + "  Here are some <a href='%s'>further statistics</a>." % (url_for(".statistics"),)
40 
41     @property
42     def summary(self):
43         hmf_knowl = '<a knowl="mf.hilbert">Hilbert modular forms</a>'
44         nf_knowl = '<a knowl="nf.totally_real">totally real number fields</a>'
45         deg_knowl = '<a knowl="nf.degree">degree</a>'
46         return "The database currently contains %s %s over %s %s of %s 2 to %s." % (comma(self.nforms), hmf_knowl, self.counts()["nfields"], nf_knowl, deg_knowl, self.counts()["maxdeg"])
47 
48     def degree_summary(self, d):
49         stats = self.statistics(d)
50         hmf_knowl = '<a knowl="mf.hilbert">Hilbert modular forms</a>'
51         nf_knowl = '<a knowl="nf.totally_real">totally real number fields</a>'
52         deg_knowl = '<a knowl="nf.degree">degree</a>'
53         level_knowl = '<a knowl="mf.hilbert.level_norm">level norm</a>'
54         return ''.join([r'The database currently contains %s ' % stats['nforms'],
55                         hmf_knowl,
56                         r' defined over %s ' % stats['nfields'],
57                         nf_knowl,
58                         r' of %s %s, with ' % (deg_knowl, d),
59                         level_knowl,
60                         r' up to %s.' % stats['maxnorm']])
61 
62     @cached_method
63     def counts(self):
64         counts = {}
65 
66 
67         counts['nforms']  = self.nforms
68         counts['nforms_c']  = comma(self.nforms)
69 
70         attrs = ["degree", "discriminant", "label"]
71         fields = list(db.hmf_fields.search({}, attrs, sort=attrs))
72         degrees = sorted(set(F["degree"] for F in fields))
73         by_deg = {d: [F for F in fields if F["degree"] == d] for d in degrees}
74         counts["degrees"] = degrees
75         counts["nfields"] = len(fields)
76         counts["nfields_c"] = comma(len(fields))
77         counts["maxdeg"] = max(degrees)
78         counts["max_deg_c"] = comma(max(degrees))
79         counts["fields_by_degree"] = {d : [F["label"] for F in by_deg[d]] for d in degrees}
80         counts["nfields_by_degree"] = {d : len(by_deg[d]) for d in degrees}
81         counts["max_disc_by_degree"] = {d : max(F["discriminant"] for F in by_deg[d]) for d in degrees}
82         return counts
83 
84     @cached_method
85     def statistics(self, d=None):
86         if d is not None:
87             return self.statistics()[int(d)]
88         nstats = db.hmf_forms.stats.numstats("level_norm", "field_label")
89         counts = db.hmf_forms.stats.column_counts("field_label")
90         nstats_by_deg = db.hmf_forms.stats.numstats("level_norm", "deg")
91         counts_by_deg = db.hmf_forms.stats.column_counts("deg")
92         C = self.counts()
93         stats = {d: {"fields": C["fields_by_degree"][d],
94                      "nfields": C["nfields_by_degree"][d],
95                      "nforms": counts_by_deg[d],
96                      "maxnorm": nstats_by_deg[d]["max"],
97                      "counts": {F: {"nforms": counts[F],
98                                     "maxnorm": nstats[F]["max"],
99                                     "field_knowl": nf_display_knowl(F, F),
100                                     "forms": lambda : url_for('hmf.hilbert_modular_form_render_webpage', field_label=F)}
101                                 for F in C["fields_by_degree"][d]}}
102                  for d in C["degrees"]}
103         return stats
104 
105     def setup(self, attributes=None, delete=False):
106         if attributes is None:
107             # Per-degree statistics aren't updated by the normal setup function
108             # The assert is for pyflakes
109             assert self.statistics()
110         super().setup(attributes, delete)
111
```
--- 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/lmfdb/hilbert_modular_forms/hmf_stats.py b/lmfdb/hilbert_modular_forms/hmf_stats.py
--- a/lmfdb/hilbert_modular_forms/hmf_stats.py
+++ b/lmfdb/hilbert_modular_forms/hmf_stats.py
@@ -97,7 +97,7 @@
                      "counts": {F: {"nforms": counts[F],
                                     "maxnorm": nstats[F]["max"],
                                     "field_knowl": nf_display_knowl(F, F),
-                                    "forms": lambda : url_for('hmf.hilbert_modular_form_render_webpage', field_label=F)}
+                                    "forms": lambda label: url_for('hmf.hilbert_modular_form_render_webpage', field_label=label)}
                                 for F in C["fields_by_degree"][d]}}
                  for d in C["degrees"]}
         return stats

{"golden_diff": "diff --git a/lmfdb/hilbert_modular_forms/hmf_stats.py b/lmfdb/hilbert_modular_forms/hmf_stats.py\n--- a/lmfdb/hilbert_modular_forms/hmf_stats.py\n+++ b/lmfdb/hilbert_modular_forms/hmf_stats.py\n@@ -97,7 +97,7 @@\n                      \"counts\": {F: {\"nforms\": counts[F],\n                                     \"maxnorm\": nstats[F][\"max\"],\n                                     \"field_knowl\": nf_display_knowl(F, F),\n-                                    \"forms\": lambda : url_for('hmf.hilbert_modular_form_render_webpage', field_label=F)}\n+                                    \"forms\": lambda label: url_for('hmf.hilbert_modular_form_render_webpage', field_label=label)}\n                                 for F in C[\"fields_by_degree\"][d]}}\n                  for d in C[\"degrees\"]}\n         return stats\n", "issue": "Bad links on HMF browse pages\nA report from the bug report system, from Paul Gunnells:  \r\n\r\n\"On \r\n\r\nhttps://www.lmfdb.org/ModularForm/GL2/TotallyReal/browse/2/ \r\n\r\nthe links in the middle column (the Number of newforms column) are all the same and point to https://www.lmfdb.org/ModularForm/GL2/TotallyReal/?field_label=2.2.497.1 instead of urls the modular form data they're supposed to.\"\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nfrom flask import url_for\nfrom lmfdb import db\nfrom lmfdb.utils import comma\nfrom lmfdb.utils.display_stats import StatsDisplay, proportioners, totaler\nfrom lmfdb.logger import make_logger\nfrom lmfdb.number_fields.web_number_field import nf_display_knowl\nfrom sage.misc.cachefunc import cached_method\n\nlogger = make_logger(\"hmf\")\n\nclass HMFstats(StatsDisplay):\n    \"\"\"\n    Class for creating and displaying statistics for Hilbert modular forms\n    \"\"\"\n    def __init__(self):\n        self.nforms = db.hmf_forms.count()\n\n    table = db.hmf_forms\n    baseurl_func = \".hilbert_modular_form_render_webpage\"\n\n    stat_list = [\n        {'cols': ['level_norm', 'deg'],\n         'totaler': totaler(),\n         'proportioner': proportioners.per_col_total},\n        {'cols': ['level_norm', 'dimension'],\n         'totaler': totaler(),\n         'proportioner': proportioners.per_col_total},\n    ]\n    buckets = {'level_norm': ['1', '2-10', '11-100', '101-1000', '1001-10000'],\n               'dimension': ['1', '2', '3', '4', '5-10', '11-20', '21-100', '101-1000']}\n    knowls = {'level_norm': 'mf.hilbert.level_norm',\n              'dimension': 'mf.hilbert.dimension',\n              'deg': 'nf.degree'}\n    short_display = {'deg': 'degree'}\n\n    @property\n    def short_summary(self):\n        return self.summary + \"  Here are some <a href='%s'>further statistics</a>.\" % (url_for(\".statistics\"),)\n\n    @property\n    def summary(self):\n        hmf_knowl = '<a knowl=\"mf.hilbert\">Hilbert modular forms</a>'\n        nf_knowl = '<a knowl=\"nf.totally_real\">totally real number fields</a>'\n        deg_knowl = '<a knowl=\"nf.degree\">degree</a>'\n        return \"The database currently contains %s %s over %s %s of %s 2 to %s.\" % (comma(self.nforms), hmf_knowl, self.counts()[\"nfields\"], nf_knowl, deg_knowl, self.counts()[\"maxdeg\"])\n\n    def degree_summary(self, d):\n        stats = self.statistics(d)\n        hmf_knowl = '<a knowl=\"mf.hilbert\">Hilbert modular forms</a>'\n        nf_knowl = '<a knowl=\"nf.totally_real\">totally real number fields</a>'\n        deg_knowl = '<a knowl=\"nf.degree\">degree</a>'\n        level_knowl = '<a knowl=\"mf.hilbert.level_norm\">level norm</a>'\n        return ''.join([r'The database currently contains %s ' % stats['nforms'],\n                        hmf_knowl,\n                        r' defined over %s ' % stats['nfields'],\n                        nf_knowl,\n                        r' of %s %s, with ' % (deg_knowl, d),\n                        level_knowl,\n                        r' up to %s.' % stats['maxnorm']])\n\n    @cached_method\n    def counts(self):\n        counts = {}\n\n\n        counts['nforms']  = self.nforms\n        counts['nforms_c']  = comma(self.nforms)\n\n        attrs = [\"degree\", \"discriminant\", \"label\"]\n        fields = list(db.hmf_fields.search({}, attrs, sort=attrs))\n        degrees = sorted(set(F[\"degree\"] for F in fields))\n        by_deg = {d: [F for F in fields if F[\"degree\"] == d] for d in degrees}\n        counts[\"degrees\"] = degrees\n        counts[\"nfields\"] = len(fields)\n        counts[\"nfields_c\"] = comma(len(fields))\n        counts[\"maxdeg\"] = max(degrees)\n        counts[\"max_deg_c\"] = comma(max(degrees))\n        counts[\"fields_by_degree\"] = {d : [F[\"label\"] for F in by_deg[d]] for d in degrees}\n        counts[\"nfields_by_degree\"] = {d : len(by_deg[d]) for d in degrees}\n        counts[\"max_disc_by_degree\"] = {d : max(F[\"discriminant\"] for F in by_deg[d]) for d in degrees}\n        return counts\n\n    @cached_method\n    def statistics(self, d=None):\n        if d is not None:\n            return self.statistics()[int(d)]\n        nstats = db.hmf_forms.stats.numstats(\"level_norm\", \"field_label\")\n        counts = db.hmf_forms.stats.column_counts(\"field_label\")\n        nstats_by_deg = db.hmf_forms.stats.numstats(\"level_norm\", \"deg\")\n        counts_by_deg = db.hmf_forms.stats.column_counts(\"deg\")\n        C = self.counts()\n        stats = {d: {\"fields\": C[\"fields_by_degree\"][d],\n                     \"nfields\": C[\"nfields_by_degree\"][d],\n                     \"nforms\": counts_by_deg[d],\n                     \"maxnorm\": nstats_by_deg[d][\"max\"],\n                     \"counts\": {F: {\"nforms\": counts[F],\n                                    \"maxnorm\": nstats[F][\"max\"],\n                                    \"field_knowl\": nf_display_knowl(F, F),\n                                    \"forms\": lambda : url_for('hmf.hilbert_modular_form_render_webpage', field_label=F)}\n                                for F in C[\"fields_by_degree\"][d]}}\n                 for d in C[\"degrees\"]}\n        return stats\n\n    def setup(self, attributes=None, delete=False):\n        if attributes is None:\n            # Per-degree statistics aren't updated by the normal setup function\n            # The assert is for pyflakes\n            assert self.statistics()\n        super().setup(attributes, delete)\n", "path": "lmfdb/hilbert_modular_forms/hmf_stats.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\nfrom flask import url_for\nfrom lmfdb import db\nfrom lmfdb.utils import comma\nfrom lmfdb.utils.display_stats import StatsDisplay, proportioners, totaler\nfrom lmfdb.logger import make_logger\nfrom lmfdb.number_fields.web_number_field import nf_display_knowl\nfrom sage.misc.cachefunc import cached_method\n\nlogger = make_logger(\"hmf\")\n\nclass HMFstats(StatsDisplay):\n    \"\"\"\n    Class for creating and displaying statistics for Hilbert modular forms\n    \"\"\"\n    def __init__(self):\n        self.nforms = db.hmf_forms.count()\n\n    table = db.hmf_forms\n    baseurl_func = \".hilbert_modular_form_render_webpage\"\n\n    stat_list = [\n        {'cols': ['level_norm', 'deg'],\n         'totaler': totaler(),\n         'proportioner': proportioners.per_col_total},\n        {'cols': ['level_norm', 'dimension'],\n         'totaler': totaler(),\n         'proportioner': proportioners.per_col_total},\n    ]\n    buckets = {'level_norm': ['1', '2-10', '11-100', '101-1000', '1001-10000'],\n               'dimension': ['1', '2', '3', '4', '5-10', '11-20', '21-100', '101-1000']}\n    knowls = {'level_norm': 'mf.hilbert.level_norm',\n              'dimension': 'mf.hilbert.dimension',\n              'deg': 'nf.degree'}\n    short_display = {'deg': 'degree'}\n\n    @property\n    def short_summary(self):\n        return self.summary + \"  Here are some <a href='%s'>further statistics</a>.\" % (url_for(\".statistics\"),)\n\n    @property\n    def summary(self):\n        hmf_knowl = '<a knowl=\"mf.hilbert\">Hilbert modular forms</a>'\n        nf_knowl = '<a knowl=\"nf.totally_real\">totally real number fields</a>'\n        deg_knowl = '<a knowl=\"nf.degree\">degree</a>'\n        return \"The database currently contains %s %s over %s %s of %s 2 to %s.\" % (comma(self.nforms), hmf_knowl, self.counts()[\"nfields\"], nf_knowl, deg_knowl, self.counts()[\"maxdeg\"])\n\n    def degree_summary(self, d):\n        stats = self.statistics(d)\n        hmf_knowl = '<a knowl=\"mf.hilbert\">Hilbert modular forms</a>'\n        nf_knowl = '<a knowl=\"nf.totally_real\">totally real number fields</a>'\n        deg_knowl = '<a knowl=\"nf.degree\">degree</a>'\n        level_knowl = '<a knowl=\"mf.hilbert.level_norm\">level norm</a>'\n        return ''.join([r'The database currently contains %s ' % stats['nforms'],\n                        hmf_knowl,\n                        r' defined over %s ' % stats['nfields'],\n                        nf_knowl,\n                        r' of %s %s, with ' % (deg_knowl, d),\n                        level_knowl,\n                        r' up to %s.' % stats['maxnorm']])\n\n    @cached_method\n    def counts(self):\n        counts = {}\n\n\n        counts['nforms']  = self.nforms\n        counts['nforms_c']  = comma(self.nforms)\n\n        attrs = [\"degree\", \"discriminant\", \"label\"]\n        fields = list(db.hmf_fields.search({}, attrs, sort=attrs))\n        degrees = sorted(set(F[\"degree\"] for F in fields))\n        by_deg = {d: [F for F in fields if F[\"degree\"] == d] for d in degrees}\n        counts[\"degrees\"] = degrees\n        counts[\"nfields\"] = len(fields)\n        counts[\"nfields_c\"] = comma(len(fields))\n        counts[\"maxdeg\"] = max(degrees)\n        counts[\"max_deg_c\"] = comma(max(degrees))\n        counts[\"fields_by_degree\"] = {d : [F[\"label\"] for F in by_deg[d]] for d in degrees}\n        counts[\"nfields_by_degree\"] = {d : len(by_deg[d]) for d in degrees}\n        counts[\"max_disc_by_degree\"] = {d : max(F[\"discriminant\"] for F in by_deg[d]) for d in degrees}\n        return counts\n\n    @cached_method\n    def statistics(self, d=None):\n        if d is not None:\n            return self.statistics()[int(d)]\n        nstats = db.hmf_forms.stats.numstats(\"level_norm\", \"field_label\")\n        counts = db.hmf_forms.stats.column_counts(\"field_label\")\n        nstats_by_deg = db.hmf_forms.stats.numstats(\"level_norm\", \"deg\")\n        counts_by_deg = db.hmf_forms.stats.column_counts(\"deg\")\n        C = self.counts()\n        stats = {d: {\"fields\": C[\"fields_by_degree\"][d],\n                     \"nfields\": C[\"nfields_by_degree\"][d],\n                     \"nforms\": counts_by_deg[d],\n                     \"maxnorm\": nstats_by_deg[d][\"max\"],\n                     \"counts\": {F: {\"nforms\": counts[F],\n                                    \"maxnorm\": nstats[F][\"max\"],\n                                    \"field_knowl\": nf_display_knowl(F, F),\n                                    \"forms\": lambda label: url_for('hmf.hilbert_modular_form_render_webpage', field_label=label)}\n                                for F in C[\"fields_by_degree\"][d]}}\n                 for d in C[\"degrees\"]}\n        return stats\n\n    def setup(self, attributes=None, delete=False):\n        if attributes is None:\n            # Per-degree statistics aren't updated by the normal setup function\n            # The assert is for pyflakes\n            assert self.statistics()\n        super().setup(attributes, delete)\n", "path": "lmfdb/hilbert_modular_forms/hmf_stats.py"}]}