>How can we trust priests for confession and celebrating the Mass if they are committing grave sins like pedophilia?
A priest has been ordained; he has received the Sacrament of Holy Orders, hence he can administer the other sacraments. Whether or not the priest sins—in whatever capacity, great or small—has no bearing on this because the power and grace he administers come from God, not him. In a similar way, there are plenty of knowledgeable and astute anons on this board who are, nevertheless, gross sinners.
>Why are these sacraments performed by such priests valid?
As I said, because they find their source, their primary cause, in God, not man.
>There is probably some % of priests that do not believe in anything.
Correct. Pray for them.
>I would honestly feel completely destroyed if I found out that the priest I've been going to for 20 years is a pedophile.
As would anyone.
>Why not just follow the life of the saints? At least we know we can follow their example
The saints all received the sacraments, were loyal to the Church, followed her decrees, etc.. This is because they had their lives orientated towards God, and not towards some vain hope in virtuous men.