If i have this integral in rectangular coordinates and i want to transform in polar coordinates $$\int_{0}^2\int_0^{x} f(x,y) \,dy\, d x$$
The limits in $\displaystyle 0\le\theta\le\frac\pi4 $ but in $r$,the limits are $0$ to ? $ 2\sec[\theta]=r$ because $x=2 $ is equal to $2\sec[\theta]=r$.
You are integrating over a triangle with vertices $(0,0)$, $(2,0)$ and $(2,2)$. This is bounded on the right by $x = 2$; in polarese that is $r\cos(\theta) = 2$ so your integral becomes $$\int_0^{\pi/4} \int_0^{2\sec(\theta)} f(r\cos(\theta), r\sin(\theta) r dr\,d\theta.$$