prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  List of items failed to import does not allow access to next pages
  **Describe the bug**
  I've recently migrated my GoodReads library to bookwyrm and I've had 109 items failing to import.
  When I go to that failed list location, https://bookwyrm.social/import/1151/failed, I see that there are 8 pages of failed results.
  However, the list point to the imported list, not to the failures.
  
  **To Reproduce**
  Steps to reproduce the behavior:
  1. Import a GoodReads CSV with many books missing from bookwyrm.
  2. Click on 'View and troubleshoot failed items': https://bookwyrm.social/import/1151/failed
  3. Hover over page two of the list
  4. See link to page 2 of the whole import list: https://bookwyrm.social/import/1151?page=2
  
  **Expected behavior**
  The link of the next pages should include the failed path: https://bookwyrm.social/import/1151/failed?page=2
  The navigation works correctly, it's just the link that is incorrect.
  
  
  **Instance**
  bookwyrm.social
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `bookwyrm/views/imports/troubleshoot.py`
  Content:
  ```
  1 """ import books from another app """
  2 from django.contrib.auth.decorators import login_required
  3 from django.core.exceptions import PermissionDenied
  4 from django.core.paginator import Paginator
  5 from django.shortcuts import get_object_or_404, redirect
  6 from django.template.response import TemplateResponse
  7 from django.utils.decorators import method_decorator
  8 from django.views import View
  9 
  10 from bookwyrm import models
  11 from bookwyrm.importers import Importer
  12 from bookwyrm.settings import PAGE_LENGTH
  13 
  14 # pylint: disable= no-self-use
  15 @method_decorator(login_required, name="dispatch")
  16 class ImportTroubleshoot(View):
  17     """problems items in an existing import"""
  18 
  19     def get(self, request, job_id):
  20         """status of an import job"""
  21         job = get_object_or_404(models.ImportJob, id=job_id)
  22         if job.user != request.user:
  23             raise PermissionDenied()
  24 
  25         items = job.items.order_by("index").filter(
  26             fail_reason__isnull=False, book_guess__isnull=True
  27         )
  28 
  29         paginated = Paginator(items, PAGE_LENGTH)
  30         page = paginated.get_page(request.GET.get("page"))
  31         data = {
  32             "job": job,
  33             "items": page,
  34             "page_range": paginated.get_elided_page_range(
  35                 page.number, on_each_side=2, on_ends=1
  36             ),
  37             "complete": True,
  38         }
  39 
  40         return TemplateResponse(request, "import/troubleshoot.html", data)
  41 
  42     def post(self, request, job_id):
  43         """retry lines from an import"""
  44         job = get_object_or_404(models.ImportJob, id=job_id)
  45         items = job.items.filter(fail_reason__isnull=False)
  46 
  47         importer = Importer()
  48         job = importer.create_retry_job(
  49             request.user,
  50             job,
  51             items,
  52         )
  53         importer.start_import(job)
  54         return redirect(f"/import/{job.id}")
  55
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/bookwyrm/views/imports/troubleshoot.py b/bookwyrm/views/imports/troubleshoot.py
  --- a/bookwyrm/views/imports/troubleshoot.py
  +++ b/bookwyrm/views/imports/troubleshoot.py
  @@ -5,6 +5,7 @@
   from django.shortcuts import get_object_or_404, redirect
   from django.template.response import TemplateResponse
   from django.utils.decorators import method_decorator
  +from django.urls import reverse
   from django.views import View
   
   from bookwyrm import models
  @@ -35,6 +36,7 @@
                   page.number, on_each_side=2, on_ends=1
               ),
               "complete": True,
  +            "page_path": reverse("import-troubleshoot", args=[job.id]),
           }
   
           return TemplateResponse(request, "import/troubleshoot.html", data)
  
verification_info: {"golden_diff": "diff --git a/bookwyrm/views/imports/troubleshoot.py b/bookwyrm/views/imports/troubleshoot.py\n--- a/bookwyrm/views/imports/troubleshoot.py\n+++ b/bookwyrm/views/imports/troubleshoot.py\n@@ -5,6 +5,7 @@\n from django.shortcuts import get_object_or_404, redirect\n from django.template.response import TemplateResponse\n from django.utils.decorators import method_decorator\n+from django.urls import reverse\n from django.views import View\n \n from bookwyrm import models\n@@ -35,6 +36,7 @@\n                 page.number, on_each_side=2, on_ends=1\n             ),\n             \"complete\": True,\n+            \"page_path\": reverse(\"import-troubleshoot\", args=[job.id]),\n         }\n \n         return TemplateResponse(request, \"import/troubleshoot.html\", data)\n", "issue": "List of items failed to import does not allow access to next pages\n**Describe the bug**\r\nI've recently migrated my GoodReads library to bookwyrm and I've had 109 items failing to import.\r\nWhen I go to that failed list location, https://bookwyrm.social/import/1151/failed, I see that there are 8 pages of failed results.\r\nHowever, the list point to the imported list, not to the failures.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. Import a GoodReads CSV with many books missing from bookwyrm.\r\n2. Click on 'View and troubleshoot failed items': https://bookwyrm.social/import/1151/failed\r\n3. Hover over page two of the list\r\n4. See link to page 2 of the whole import list: https://bookwyrm.social/import/1151?page=2\r\n\r\n**Expected behavior**\r\nThe link of the next pages should include the failed path: https://bookwyrm.social/import/1151/failed?page=2\r\nThe navigation works correctly, it's just the link that is incorrect.\r\n\r\n\r\n**Instance**\r\nbookwyrm.social\n", "before_files": [{"content": "\"\"\" import books from another app \"\"\"\nfrom django.contrib.auth.decorators import login_required\nfrom django.core.exceptions import PermissionDenied\nfrom django.core.paginator import Paginator\nfrom django.shortcuts import get_object_or_404, redirect\nfrom django.template.response import TemplateResponse\nfrom django.utils.decorators import method_decorator\nfrom django.views import View\n\nfrom bookwyrm import models\nfrom bookwyrm.importers import Importer\nfrom bookwyrm.settings import PAGE_LENGTH\n\n# pylint: disable= no-self-use\n@method_decorator(login_required, name=\"dispatch\")\nclass ImportTroubleshoot(View):\n    \"\"\"problems items in an existing import\"\"\"\n\n    def get(self, request, job_id):\n        \"\"\"status of an import job\"\"\"\n        job = get_object_or_404(models.ImportJob, id=job_id)\n        if job.user != request.user:\n            raise PermissionDenied()\n\n        items = job.items.order_by(\"index\").filter(\n            fail_reason__isnull=False, book_guess__isnull=True\n        )\n\n        paginated = Paginator(items, PAGE_LENGTH)\n        page = paginated.get_page(request.GET.get(\"page\"))\n        data = {\n            \"job\": job,\n            \"items\": page,\n            \"page_range\": paginated.get_elided_page_range(\n                page.number, on_each_side=2, on_ends=1\n            ),\n            \"complete\": True,\n        }\n\n        return TemplateResponse(request, \"import/troubleshoot.html\", data)\n\n    def post(self, request, job_id):\n        \"\"\"retry lines from an import\"\"\"\n        job = get_object_or_404(models.ImportJob, id=job_id)\n        items = job.items.filter(fail_reason__isnull=False)\n\n        importer = Importer()\n        job = importer.create_retry_job(\n            request.user,\n            job,\n            items,\n        )\n        importer.start_import(job)\n        return redirect(f\"/import/{job.id}\")\n", "path": "bookwyrm/views/imports/troubleshoot.py"}], "after_files": [{"content": "\"\"\" import books from another app \"\"\"\nfrom django.contrib.auth.decorators import login_required\nfrom django.core.exceptions import PermissionDenied\nfrom django.core.paginator import Paginator\nfrom django.shortcuts import get_object_or_404, redirect\nfrom django.template.response import TemplateResponse\nfrom django.utils.decorators import method_decorator\nfrom django.urls import reverse\nfrom django.views import View\n\nfrom bookwyrm import models\nfrom bookwyrm.importers import Importer\nfrom bookwyrm.settings import PAGE_LENGTH\n\n# pylint: disable= no-self-use\n@method_decorator(login_required, name=\"dispatch\")\nclass ImportTroubleshoot(View):\n    \"\"\"problems items in an existing import\"\"\"\n\n    def get(self, request, job_id):\n        \"\"\"status of an import job\"\"\"\n        job = get_object_or_404(models.ImportJob, id=job_id)\n        if job.user != request.user:\n            raise PermissionDenied()\n\n        items = job.items.order_by(\"index\").filter(\n            fail_reason__isnull=False, book_guess__isnull=True\n        )\n\n        paginated = Paginator(items, PAGE_LENGTH)\n        page = paginated.get_page(request.GET.get(\"page\"))\n        data = {\n            \"job\": job,\n            \"items\": page,\n            \"page_range\": paginated.get_elided_page_range(\n                page.number, on_each_side=2, on_ends=1\n            ),\n            \"complete\": True,\n            \"page_path\": reverse(\"import-troubleshoot\", args=[job.id]),\n        }\n\n        return TemplateResponse(request, \"import/troubleshoot.html\", data)\n\n    def post(self, request, job_id):\n        \"\"\"retry lines from an import\"\"\"\n        job = get_object_or_404(models.ImportJob, id=job_id)\n        items = job.items.filter(fail_reason__isnull=False)\n\n        importer = Importer()\n        job = importer.create_retry_job(\n            request.user,\n            job,\n            items,\n        )\n        importer.start_import(job)\n        return redirect(f\"/import/{job.id}\")\n", "path": "bookwyrm/views/imports/troubleshoot.py"}]}