diff --git a/server/index.js b/server/index.js index 71006bd..f289ce5 100644 --- a/server/index.js +++ b/server/index.js @@ -65,7 +65,7 @@ const shouldEnableRateLimit = () => { const getRateLimitMax = () => { // Environment variable override takes precedence if (process.env.RATE_LIMIT_MAX) { - return parseInt(process.env.RATE_LIMIT_MAX); + return parseInt(process.env.RATE_LIMIT_MAX, 10); } // Production: 100 requests per 15 minutes diff --git a/server/routes/questions.js b/server/routes/questions.js index 9d64260..4e4971a 100644 --- a/server/routes/questions.js +++ b/server/routes/questions.js @@ -108,7 +108,7 @@ router.get('/', async (req, res) => { .populate('author', 'username reputation avatar') .sort(sortOption) .skip(skip) - .limit(parseInt(limit)) + .limit(parseInt(limit, 10)) .lean() const total = await Question.countDocuments(query) @@ -126,7 +126,7 @@ router.get('/', async (req, res) => { res.json({ questions: questionsWithVirtuals, pagination: { - currentPage: parseInt(page), + currentPage: parseInt(page, 10), totalPages, total, hasNext: page < totalPages,