There is an estimate that between 4 and 6% of Catholic priests have been involved with some type of pedarasty. With 750,000 priests worldwide the 40,000 figure is not out line with that. It could be however that this incidence is largely in the developed West. Pervasive social strictures against homosexuality in developing countries could mean it is much less prevalent there.
It should be noted that the whole Church is now moving to a One Strike policy.. one substantiated charge and you are defrocked, all charges are referred to local police for investigation and prosecution, no tolerance of cover up-of charges by superiors is acceptable.. at the cost of their jobs.
This was put in place in North America under the over all supervision of Cardinal Ratzinger, who as Prefect of the Congregation of the Faith was responsible for supervision of Canon Law (laws affecting clerics) and its court system under JPII.
The Magisterium of the Church realizes that forces within and without the Catholic Church deeply antithetical to the conservative agenda of Pope Benedict are using this to leverage agendas that include the end of priestly celibacy, the ordination of women, the 'decentralization' of Catholicism (including theology) to Lay Councils in parishes. None of those things will happen under Benedict.. in fact there is no chance that they will happen at all.
However placing the blame on the structure of the Church promotes these causes, which is why the Pontiff has become a target as the head of the Catholic Church. In actual fact these pedophiles would have found some other institution or opportunity to carry out their abuse, but there is no doubt a culture of arrogance and denial has afflicted the Church for a long time on this issue.
The Church has much more stringent admission requirements for the priesthood now, which includes psychological testing. And has implemented a strict oversight program of seminaries to ensure the exclusion of all those with homosexual tendencies are excluded.. from whence the large part of the problem originates.