pub fn count_items(conn: &Connection, filter: &ItemFilter) -> Result<u64>
Count items matching the given filter criteria.
Returns an error if the query fails.