Fix incorrect page number bug

This commit is contained in:
Ayooluwa Isaiah
2020-12-26 09:56:18 +01:00
parent cc4a2af266
commit d28e34153f

View File

@@ -81,7 +81,7 @@ func searchHandler(newsapi *news.Client) http.HandlerFunc {
search := &Search{
Query: searchQuery,
NextPage: nextPage,
TotalPages: int(math.Ceil(float64(results.TotalResults / newsapi.PageSize))),
TotalPages: int(math.Ceil(float64(results.TotalResults) / float64(newsapi.PageSize))),
Results: results,
}