You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-25, 25' at line 1
query=SELECT products.*, min(products_atts.price) as pricefrom, count(products_atts.product_id) as attcount, products_images.filename as thefile from prodcat_weight inner join products on products.prod_id=prodcat_weight.prod_id left join products_atts on products.id=products_atts.product_id left join products_images on products.prod_id=products_images.prod_id and products_images.firstimg=1 WHERE prodcat_weight.cat_id in (93,42,96,95,41,36,74,77,71,73,72,76,75,70,40,92,91,39,85,90,89,87,86,88,35,59,62,124,60,68,69,66,63,67,61,65,64,58,123,34,48,52,57,44,50,45,46,43,56,127,94,125,53,54,55,49,47,51,38,83,82,84,37,78,81,80,79,5) and prodcat_weight.hidden='0' group by products.id order by prodcat_weight.weight ASC, id desc LIMIT -25, 25