Special-case the WHERE for a single restricted log type; use the database functions...