From e0da0a9197adced52d4fd936fa6d309040de8feb Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 24 Sep 2023 02:08:33 +0200
Subject: [PATCH] In Bookmaker, fix page numbering / selection bug.

---
 bookmaker.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bookmaker.py b/bookmaker.py
index 3a36b96..b9daa0b 100755
--- a/bookmaker.py
+++ b/bookmaker.py
@@ -36,6 +36,7 @@ def parse_page_range(range_string, pages):
     return start_page, end_page
 pages_to_add = []
 opened_files = []
+new_page_num = 0
 for i, input_file in enumerate(args.input_file):
     file = open(input_file, 'rb')
     opened_files += [file]
@@ -44,12 +45,11 @@ for i, input_file in enumerate(args.input_file):
     if args.page_range and len(args.page_range) > i:
         range_string = args.page_range[i]
     start_page, end_page = parse_page_range(range_string, reader.pages)
-    new_page_num = 0
     for old_page_num in range(start_page, end_page):
         new_page_num += 1
-        page = reader.pages[new_page_num]
+        page = reader.pages[old_page_num]
         pages_to_add += [page]
-        print("-i, -p: read in %s page number %d as new page %d" % (input_file, new_page_num+1, new_page_num))
+        print("-i, -p: read in %s page number %d as new page %d" % (input_file, old_page_num+1, new_page_num))
 
 # rotate page canvas
 if args.rotate:
-- 
2.30.2