Level 88
You can do it like so
DB::select('SELECT * FROM
(
SELECT A.id as id,A.name,C.category_name
FROM alerts AS A
LEFT JOIN categories as C
ON A.category_id = C.id
where A.id < ?
order by id asc
limit ?
) as myAlias
ORDER BY id ASC', [$OldLowestID, $pagesize]);
Basically just replace each variable with a question and add them in the array as a second argument. Make sure you're doing that in the correct order.