diff --git a/src/Routes/Images.c b/src/Routes/Images.c index ae25cf8..0f8ff1e 100644 --- a/src/Routes/Images.c +++ b/src/Routes/Images.c @@ -20,15 +20,20 @@ int images_handler(UrlParams *params) { } } - char page_str[16], prev_str[16], next_str[16]; + char page_str[16], prev_str[16], next_str[16], two_prev_str[16], + two_next_str[16]; + snprintf(page_str, sizeof(page_str), "%d", page); snprintf(prev_str, sizeof(prev_str), "%d", page > 1 ? page - 1 : 0); snprintf(next_str, sizeof(next_str), "%d", page + 1); - + snprintf(two_prev_str, sizeof(two_prev_str), "%d", page > 2 ? page - 2 : 0); + snprintf(two_next_str, sizeof(two_next_str), "%d", page + 2); context_set(&ctx, "query", raw_query); context_set(&ctx, "page", page_str); context_set(&ctx, "prev_page", prev_str); context_set(&ctx, "next_page", next_str); + context_set(&ctx, "two_prev_page", two_prev_str); + context_set(&ctx, "two_next_page", two_next_str); char *display_query = url_decode_query(raw_query); context_set(&ctx, "query", display_query); diff --git a/src/Routes/Search.c b/src/Routes/Search.c index 16ff1c0..b9851d7 100644 --- a/src/Routes/Search.c +++ b/src/Routes/Search.c @@ -174,13 +174,18 @@ int results_handler(UrlParams *params) { context_set(&ctx, "query", raw_query); - char page_str[16], prev_str[16], next_str[16]; + char page_str[16], prev_str[16], next_str[16], two_prev_str[16], + two_next_str[16]; snprintf(page_str, sizeof(page_str), "%d", page); snprintf(prev_str, sizeof(prev_str), "%d", page > 1 ? page - 1 : 0); snprintf(next_str, sizeof(next_str), "%d", page + 1); + snprintf(two_prev_str, sizeof(two_prev_str), "%d", page > 2 ? page - 2 : 0); + snprintf(two_next_str, sizeof(two_next_str), "%d", page + 2); context_set(&ctx, "page", page_str); context_set(&ctx, "prev_page", prev_str); context_set(&ctx, "next_page", next_str); + context_set(&ctx, "two_prev_page", two_prev_str); + context_set(&ctx, "two_next_page", two_next_str); if (!raw_query || strlen(raw_query) == 0) { send_response("