To retrieve the current URL path in Magento, use the below-given syntax at first.
BY Best Interview Question ON 03 Mar 2019

Example

$currentUrl = Mage::helper('core/url')->getCurrentUrl();
$url = Mage::getSingleton('core/url')->parseUrl($currentUrl);
$path = $url->getPath();