import db

user_id = 2
page1 = db.execute_query('SELECT id FROM orders WHERE user_id = %s ORDER BY created_at DESC LIMIT 10 OFFSET 0', (user_id,))
page2 = db.execute_query('SELECT id FROM orders WHERE user_id = %s ORDER BY created_at DESC LIMIT 10 OFFSET 10', (user_id,))

print(f"Page 1 (10 orders): {[r['id'] for r in page1]}")
print(f"Page 2 (remaining orders): {[r['id'] for r in page2]}")

count_res = db.execute_query('SELECT COUNT(*) as total FROM orders WHERE user_id = %s', (user_id,))
print(f"Total found: {count_res[0]['total']}")
