Scaling law for critical currents and magnetization in high temperature superconductors