diff --git a/pages/last_added/[page].tsx b/pages/last_added/[page].tsx index c4430cc..ca641d8 100644 --- a/pages/last_added/[page].tsx +++ b/pages/last_added/[page].tsx @@ -86,7 +86,7 @@ export async function getStaticProps(context: any) { if (context.params.page) { const images = (await db_ops.image_ops.get_all_images()).reverse() const page = parseInt(context.params.page) - if (page <= Math.ceil(images.length / images_on_page)) { + if (page >= 1 && page <= Math.ceil(images.length / images_on_page)) { for (let i = (page - 1) * images_on_page; (i < (page) * images_on_page) && (i < images.length); i++) { photos.push({ src: `/webp_images/${images[i].id}.webp`, diff --git a/pages/search.tsx b/pages/search.tsx index 5ed6a56..1b97fcb 100644 --- a/pages/search.tsx +++ b/pages/search.tsx @@ -60,7 +60,7 @@ export async function getServerSideProps(context: any) { if (page <= Math.ceil(images.length / images_on_page)) { for (let i = (page - 1) * images_on_page; (i < (page) * images_on_page) && (i < images.length); i++) { photos.push({ - src: `/images/${images[i].id}.${images[i].file_ext}`, + src: `/webp_images/${images[i].id}.webp`, key: `/image/${images[i].id}`, width: images[i].width, height: images[i].height diff --git a/pages/top_rated/[page].tsx b/pages/top_rated/[page].tsx index a3b78c0..85d085b 100644 --- a/pages/top_rated/[page].tsx +++ b/pages/top_rated/[page].tsx @@ -86,7 +86,7 @@ export async function getStaticProps(context: any) { if (context.params.page) { const images = (await db_ops.image_ops.get_all_images()).sort((a, b) => b.wilson_score - a.wilson_score) const page = parseInt(context.params.page) - if (page <= Math.ceil(images.length / images_on_page)) { + if (page >= 1 && page <= Math.ceil(images.length / images_on_page)) { for (let i = (page - 1) * images_on_page; (i < (page) * images_on_page) && (i < images.length); i++) { photos.push({ src: `/webp_images/${images[i].id}.webp`,